Task 2 - Hybrid Cloud

 TASK 2 

WebServer With EFS , S3 and Cloudfront Using Terraform

by : - SHIVANGI SAXENA



TASK OBJECTIVES : -

  1. Create Security group which allow the port 80
  2. Launch EC2 instance.
  3. In this Ec2 instance use the existing key or provided key and security group which we have created in step 1.
  4. Launch one Volume using the EFS service and attach it in your vpc, then mount that volume into /var/www/html
  5. The 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.

TASK IMPLEMENTATION

  • STEP 1: Specify the Provider

    • Provider is used to specify the cloud provider that we are going to use in terraform.Here we are using AWS as a provider.





    • STEP 2: Creating key-pairs

      • A key pair, consisting of a private key and a public key, is a set of security credentials that you use to prove your identity when connecting to an instance. Amazon EC2 stores the public key, and you store the private key. You use the private key, instead of a password, to securely access your instances.




    • STEP 3: Creating a Security Group

      • In security group, we define a firewall that allows SSH, HTTP & one more port through which EFS can communicate, the inbound or the traffic coming in is called ingress and the outbound traffic is called egress. CIDR defines the range.


    • STEP 4: Launching EFS and subnet

      • This is to create EFS, this will create EFS cluster with the encryption done on the data in rest.




    • STEP 5: Launching instance(EC2)

      • Now we will create the instance and then mount the EFS which we created in this instance i.e taskinstance2

    • STEP 6: Creating S3 bucket

      • This will help us create S3 bucket, this works as unified storage from where we will use cloud front to make it globally scaled using its power of doing CDN- Content Delivery Network.
     
      • Now we will upload the static data to the s3 bucket.

    • STEP 7: Creating CloudFront

      • CloudFront is the service that is provided by the AWS in which they create small data centers where they store our data to achieve low latency. It will create a CloudFront distribution using an S3 bucket. In this bucket, we have stored all of the assets of our site like images, icons, etc.


    We have to initialize terraform so that it can download AWS provider plugin.





    Final output


    Comments