What is an EFS?
An Amazon S3 bucket is a public cloud storage resource available in Amazon Web Services’ (AWS). It stands for Simple Storage Service (S3), an object storage offering. Amazon S3 buckets, which are similar to file folders, store objects, which consist of data and its descriptive metadata.
What is Cloud Front?
Amazon CloudFront is a content delivery network offered by Amazon Web Services. Content delivery networks provide a globally-distributed network of proxy servers which cache content, such as web videos or other bulky media, more locally to consumers, thus improving access speed for downloading the content.
What is Terraform?
Terraform is an open-source infrastructure as code software tool created by HashiCorp. It enables users to define and provision a datacenter infrastructure using a high-level configuration language known as Hashicorp Configuration Language, or optionally JSON.
Some tasks List
STEP1: Login with CLI then use aws configure command and give the access key, secret key from credential file and region name.
STEP2: Create a directory and then create a file inside it with “.tf” extension.
Now we will write the code in the terraform file we created.
Step3: Give the name of the provider(AWS) to whom the Terraform will contact.
STEP 4: Create public and private key pair
STEP 5: Creating Security group with allowing Port 80 For http and Port 22 For ssh
STEP 6: Launch EC2 instances.
STEP 7: Launch one Volume using the EFS service and attach it in your vpc, then mount that volume into /var/www/html
STEP 8: Create S3 bucket, and copy deploy the images from github repo into the s3 bucket and change the permission to public readable.
STEP 9. Create a Cloudfront using s3 bucket(which contains images) and use the Cloudfront URL to update in code in /var/www/html
Now, use the following commands to initialize and run the code.
terraform init
terraform validate
So finally this webpage is created by terraform just by running a single command.