diff --git a/Github-Actions/Docker_Img_ECR/.github/workflows/aws.yaml b/Github-Actions/Docker_Img_ECR/.github/workflows/aws.yaml new file mode 100644 index 0000000..62fd318 --- /dev/null +++ b/Github-Actions/Docker_Img_ECR/.github/workflows/aws.yaml @@ -0,0 +1,35 @@ +name: Deploy to production + +on: + push: + branches: [ main ] + +jobs: + + deploy: + name: Build image + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: eu-central-1 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, tag, and push image to Amazon ECR + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: nginx-docker + IMAGE_TAG: nginx-v0.0.1 + run: | + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \ No newline at end of file diff --git a/Github-Actions/Docker_Img_ECR/Dockerfile b/Github-Actions/Docker_Img_ECR/Dockerfile new file mode 100644 index 0000000..97a5c81 --- /dev/null +++ b/Github-Actions/Docker_Img_ECR/Dockerfile @@ -0,0 +1,5 @@ +FROM nginx:latest + +RUN apt update -y + +EXPOSE 8080 \ No newline at end of file diff --git a/Github-Actions/Docker_Img_ECR/README.md b/Github-Actions/Docker_Img_ECR/README.md new file mode 100644 index 0000000..d7a6c55 --- /dev/null +++ b/Github-Actions/Docker_Img_ECR/README.md @@ -0,0 +1,26 @@ +# Github Actions Workflow to build and push docker image to AWS ECR + +## Step 1: +Create AWS ECR Repository + +`NOTE: make sure to update the variable `**ECR_REPOSITORY: nginx-docker** [aws.yaml](https://github.com/johnbedeir/Github_Actions_Docker_ECR/blob/main/.github/workflows/aws.yaml#:~:text=ECR_REPOSITORY%3A-,nginx%2Ddocker,-IMAGE_TAG%3A%20nginx) ` with the repository name` + +## Step 2: +Create github repository and create two Github Secrets using the following names and add your **IAM Access Key and Secret Accress Key** +``` +AWS_ACCESS_KEY_ID +AWS_SECRET_ACCESS_KEY +``` + +## Step 3: +Commit the following files you found in this repository + +1. Dockerfile +2. .github/workflows.aws.yaml + + + + + + + diff --git a/Terraform/AWS/EKS/README.md b/Terraform/AWS/EKS/README.md new file mode 100644 index 0000000..f166a81 --- /dev/null +++ b/Terraform/AWS/EKS/README.md @@ -0,0 +1,33 @@ +# Build Kubernetes Cluster (EKS) using Terraform + +### This project is to build Kubernetes Cluster (EKS) on AWS using Terraform. + +**1. eks.tf** : AWS EKS resource and attache VPC + +**2. igw.tf** : Internet Gateway + +**3. nat.tf** : AWS Elastic IP and NAT gateway + +**4. nodes.tf** : EC2 (nodes) for the cluster + +**5. provider.tf** : AWS Provider + +**6. routes.tf** : Private and Public route tables + +**7. subnets.tf** : Private and Public subnets on different zones + +**8. vpc.tf** : Creating VPC + + +## Step 1: +``` +terraform init +``` +## Step 2: +``` +terraform plan +``` +## Step 3: +``` +terraform apply -auto-approve +``` \ No newline at end of file