Tasks completed during Summer Training @LinuxWorldIndia
AWS Infrastructure As Code Using Terraform
- Create the key and security group which allow the port
80
. - Launch EC2 instance.
- In this Ec2 instance use the key and security group which we have created in step 1.
- Launch one Volume (EBS) and mount that volume into
/var/www/html
- Developer have uploaded the code into github repo also the repo has some images.
- Copy the github repo code into /var/www/html
- Create S3 bucket, and copy/deploy the images from github repo into the s3 bucket and change the permission to public readable.
- Create a Cloudfront Distribution using S3 bucket(which contains images) and use the Cloudfront URL to update in code in
/var/www/html
AWS Infrastructure As Code Using Terraform
- Create Security group which allow the port
80
. - Launch EC2 instance.
- In this Ec2 instance use the existing key or provided key and security group which we have created in step 1.
- Launch one Volume using the EFS service and attach it in your vpc, then mount that volume into
/var/www/html
- Developer have uploaded the code into github repo also the repo has some images.
- Copy the github repo code into
/var/www/html
- Create S3 bucket, and copy/deploy the images from github repo into the s3 bucket and change the permission to public readable.
- Create a Cloudfront Distribution using S3 bucket(which contains images) and use the Cloudfront URL to update in code in
/var/www/html
Use Terraform to create and configure customized VPC for secure Wordpress Deployment
-
Write a Infrastructure as code using terraform, which automatically create a VPC.
-
In that VPC we have to create 2 subnets:
-
public subnet
[ Accessible for Public World! ] -
private subnet
[ Restricted for Public World! ] -
Create a public facing internet gateway for connect our VPC/Network to the internet world and attach this gateway to our VPC.
-
Create a routing table for Internet gateway so that instance can connect to outside world, update and associate it with public subnet.
-
Launch an ec2 instance which has Wordpress setup already having the security group allowing port
80
so that our client can connect to our wordpress site.Also attach the key to instance for further login into it. -
Launch an ec2 instance which has MYSQL setup already with security group allowing port
3306
in private subnet so that our wordpress vm can connect with the same.Also attach the key with the same.
Note: Wordpress instance has to be part of public subnet so that our client can connect our site. mysql instance has to be part of private subnet so that outside world can't connect to it. Don't forgot to add auto ip assign and auto dns name assignment option to be enabled.
Perform task-3 with an additional feature to be added that is NAT Gateway to provide the internet access to instances running in the private subnet. Performing the following steps:
- Write an Infrastructure as code using terraform, which automatically create a VPC.
- In that VPC we have to create 2 subnets:
public subnet
[ Accessible for Public World! ]private subnet
[ Restricted for Public World! ]
- Create a public facing internet gateway for connect our VPC/Network to the internet world and attach this gateway to our VPC.
- Create a routing table for Internet gateway so that instance can connect to outside world, update and associate it with public subnet.
- Create a NAT gateway for connect our VPC/Network to the internet world and attach this gateway to our VPC in the public network
- Update the routing table of the private subnet, so that to access the internet it uses the nat gateway created in the public subnet
- Launch an ec2 instance which has Wordpress setup already having the security group allowing port
80
sothat our client can connect to our wordpress site. Also attach the key to instance for further login into it. - Launch an ec2 instance which has MYSQL setup already with security group allowing port
3306
in private subnet so that our wordpress vm can connect with the same. Also attach the key with the same.
Note: Wordpress instance has to be part of public subnet so that our client can connect our site. mysql instance has to be part of private subnet so that outside world can't connect to it. Don't forgot to add auto ip assign and auto dns name assignment option to be enabled.
Deploy the Wordpress application on Kubernetes and AWS using terraform including the following steps:
- Write an Infrastructure as code using terraform, which automatically deploy the Wordpress application
- On AWS, use RDS service for the relational database for Wordpress application.
- Deploy the Wordpress as a container either on top of Minikube or EKS or Fargate service on AWS
- The Wordpress application should be accessible from the public world if deployed on AWS or through workstation if deployed on Minikube.
- Clone this repo.
- Download and install aws-cli-v2 place it somewhere and add the exact path to the
PATH
environment variable. - For working with AWS create an
aws cli profile
usingaws configure --profile <newProfileName>
and configure it withaccess
andsecret keys
. Terraform will use the profile specified by us in the.tf
code. - I have a profile named
hybrid
created on my system. (The profiles are located in$HOME/.aws/
by default.) - Download and install
terraform
binary extract it somewhere and add the exact path to thePATH
environment variable. terraform init
: This will cause terraform to check through your code and download the plugins required for the used providers eg.terraform-provider-aws
or eventerraform-provider-aws
.terraform apply --auto-approve
: This starts the infrastructure building process.- After done use
terraform destroy --auto-approve
: This starts the infrastructure destroying process.