ValaxyTech / Weekly-Assignments

8 stars 88 forks source link

Write ‘Infrastructure as a Code” to deploy AWS cloud infrastructure resources for High Available web application hosting #5

Open iwayqtech opened 3 years ago

iwayqtech commented 3 years ago

tf-webserver

Pre-requisites:

  1. Login to AWS management console.
  2. Create S3 bucket to store terraform state files
  3. Create an IAM user with programmatic access with Administrator Policy attached.

Deployment:

  1. Deploy VPC
  2. Write a terraform module to deploy the VPC architecture shown.
  3. Deploy VPC architecture - Choose any IP range of your choice. Below resources need to be deployed. 3.1 VPC 3.2 Internet Gateway 3.3 Public Subnets in 1a & 1b zones 3.4 Private Subnets in 1a & 1b zones 3.5 Private Route table 3.6 Public Route table

Deploy Route53 hosted zone

  1. Write terraform to deploy Route53 hosted zone
  2. If you do not have an authoritative domain then take any xyz.com just to complete the terraform.
  3. Below resources need to be deployed 3.1 Hosted zone

Deploy S3 Bucket

  1. Write terraform to deploy Private S3 bucket (us-east-1 region) for future use to host the web server configuration
  2. Below resources need to be deployed 2.1 S3 Bucket 2.2 Upload index.html file to S3 bucket

Deploy EC2 Instance to host high available web application

  1. Write terraform module to deploy EC2 resources for web application deployment as per the architecture shown into the existing VPC(created in step# 1)
  2. Deploy 2 EC2 instances into 1a & 1b availability zones
  3. Below resources need to be created 3.1 Private EC2 instance in 1a zone 3.2 Private EC2 instance in 1b zone 3.2 EC2 Instance userdata 3.3 Security Group (allow 80 & 22 ports) - attach to both instances 3.4 Internet facing Network Load Balancer 3.5 Target Group 3.6 Alias Record in Route 53 hosted zone. 3.7 IAM Instance Profile(IAM Role) - attach to both ec2 instances 3.8 Below policies need to be added to the IAM Instance Profile (IAM Role) i) AmazonEC2forSSM ii) amazons3fullaccess

Verification

  1. Verify if you able to login to the EC2 instances using session manager
  2. Verify EC2 instances are healthy in the target group
  3. Destroy the resources as per your convenient to avoid billing

Validation

  1. Create account in bitbucket.org
  2. Login to bitbucket and create a private repository to store the terraform code. Example naming standard for the two repositories. -terraform-base -terraform-app
  3. Add me as moderators to the both bitbucket repositories(Below are email ids) iwayqtech@gmail.com
  4. Create branch in each repository and push the code -terraform-base (Push VPC, Route53, S3 Bucket Terraform code) -terraform-app (Push EC2 instance terraform code)
  5. Create PR (Pull Request) to merge the code into the Master branch.
  6. We will review the PR and approve if the code meets the best practices.
bikash2241 commented 3 years ago

image image image image Completed this assignment . Creating AWS resource using terraform is like fun. I enjoyed it.

iwayqtech commented 3 years ago

@bikash2241 You can add me as moderator to your bitbucket repos and raise PR for review.

bikash2241 commented 3 years ago

Invited as moderator .. I think once that request is approved I am able to raise review request