task 1
Harsh Rajotya
Technical Blogger & DevOps Engineer @ Medium & DevOpsFarm Inc | Writing, Automation, Cloud
What is Cloud Computing?
Cloud computing is the on-demand availability of computer system resources, especially data storage (cloud storage) and computing power, without direct active management by the user. The term is generally used to describe data centers available to many users over the Internet. Large clouds, predominant today, often have functions distributed over multiple locations from central servers. If the connection to the user is relatively close, it may be designated an edge server.
What is AWS?
Amazon Web Services (AWS) is a subsidiary of Amazon that provides on-demand cloud computing platforms and APIs to individuals, companies, and governments, on a metered pay-as-you-go basis. In aggregate, these cloud computing web services provide a set of primitive abstract technical infrastructure and distributed computing building blocks and tools.
What is Terraform?
Terraform is an open-source infrastructure as code software tool created by HashiCorp. It enables users to define and provision a data center infrastructure using a high-level configuration language known as Hashicorp Configuration Language (HCL), or optionally JSON.
Description of Task -1:-
1. Create the key and security group which allows 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. A developer has 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
Optional
1) Those who are familiar with Jenkins or are in DevOps AL have to integrate Jenkins in this task wherever you feel can be integrated
2) create a snapshot of ebs
Pre-requisite: - terraform should be installed on your pc.
Solution :-
We will create one directory and through CLI we will initialize terraform in that directory by using below command
terraform init
In the directory where we have initialized terraform, we will create one file with .tf extension . Now we will write our code.
Step 1 :- First of all we will write the details about service provider and in my case, I have used AWS and also I have created one profile named harsh
Step 2: - Now we need to create one key-pair and save the key in file in. This key pair's public key will be registered with AWS to allow logging-in to EC2 instances.
Step 3 :- We have to create security group which will allow port 22 and 80. A security group controls the inbound and outbound traffic to the server.
Step 4 :- We need to launch ec2 instance and in creating this, we will use the above-created key-pair and security group and instance should have PHP, https, and git services.
Step 5:- Now we need to create one ebs volume and have to attach that volume to the instance.
Step 6 :- We have to create S3 bucket and copy/deploy the images from Github repo into the s3 bucket.
Note :- I have uploaded image from local . I'm trying to deploy the images from Github repo but in this, I had manually uploaded from local.
Step 7:- We need to create a Cloudfront using s3 bucket(which contains images) and use the Cloudfront URL to update in code in /var/www/html.
Now on CLI run below command to run our code