AWS Cloud Project
About Task:
Launching application using Terraform-
1. Create the key and security group which allow the port 80.
2. Launch EC2 instance.
3. In this Ec2 instance use the key and security group which we have created in step 1.
4. Launch one Volume (EBS) and mount that volume into /var/www/html
5. Developer have uploaded the code into GitHub repo also the repo has some images.
6. Copy the GitHub repo code into /var/www/html
7. Create S3 bucket, and copy/deploy the images from GitHub repo into the s3 bucket and change the permission to public readable.
8. Create a CloudFront using s3 bucket (which contains images) and use the CloudFront URL to update in code in /var/www/html.
Prerequisite -
⦁ Basic knowledge about AWS, such as EC2, AMI, Security Group, IAM user
⦁ An AWS account
Explanation of project:
Step-1 Cloud Provider
Firstly specify that we are using AWS service, filling region and profile name
Step-2 Creating the key-pair
Output of the following code:
Step-3 Creating security group
A security group acts as a virtual firewall for your instance to control incoming and outgoing traffic.We can add rules to each security group that allow traffic to or from its associated instances. We can modify the rules for a security group at any time.
Creating security group which allows port no. 80 (for webserver) and also allowing the port no. 22( for SSH).
Output of the above code:
Step-4 Launching EC2-Instance
An EC2 instance is a virtual server in Amazon's Elastic Compute Cloud (EC2) for running applications on the Amazon Web Services (AWS) infrastructure. AWS is a comprehensive, evolving cloud computing platform; EC2 is a service that allows business subscribers to run application programs in the computing environment.
Launching the EC2 instance from terraform using the key and security group.
Output of the above code:
Step-5 Launching the EBS volume
An Amazon EBS volume is a durable, block-level storage device that you can attach to one instance or to multiple instances at the same time. You can use EBS volumes as primary storage for data that requires frequent updates, such as the system drive for an instance or storage for a database application.
Launching the EBS volume with instance with same Availability Zone as Instance have:
Output of the above code:
Step-6 Null Resources
The null_resource resource implements the standard resource lifecycle but takes no further action.
Step-7 Creating S3 Bucket
An Amazon S3 bucket is a public cloud storage resource available in Amazon Web Services' (AWS) 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.
Creating the S3 bucket and uploading image into S3 bucket from GitHub repo Dynamically. Name of image is Path.jpg which i uploaded on GitHub.
Output of the above code:
Step-8 Creating CloudFront
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.
Creating CloudFront which distribute my image from S3 bucket in all near edge location.
Output of the above code:
Step-9 CloudFront URL and the IP of the instance can be printed following code
Final Output:
I have uploaded every content related to my project on my GitHub URL
Thank you!!