EMAIL SUPPORT

dclessons@dclessons.com

LOCATION

AF

LAB Configure Cloud Front Origin Groups

LAB Configure Cloud Front Origin Groups

LAB Configure Cloud Front Origin Groups

Task :

In this lab we will create to add origin EC2 IPV4 DNS and S3 bucket endpoints as the origin in CloudFront Distribution

Step 1: Create Bucket and Upload the index.html file.

Go to AWS Service | under S3 | Create Bucket | Bucket name : dcl12345 Region you can choose based on your Region | Under Object OwnerShip : ACL disabled.

Uncheck Block all public Access and Check the Acknowledge Section

Click to Create Bucket button

Once Bucket is created , Select your bucket | Object | Click Upload | and upload index.html

Now you have to make the object public accessible | Select your Bucket | permission | Edit the Bucket policy

Copy the below Bucket Policy , Only change your bucket ARN on resource key-value

{

   "Id":"Policy1",

   "Version":"2012-10-17",

   "Statement":[

      {

         "Sid":"Stmt1",

         "Action":[

            "s3:GetObject"

         ],

         "Effect":"Allow",

         "Resource":"arn:aws:s3:::dcl12345/*",

         "Principal":"*"

      }

Click on Save Changes

Step2: Create CloudFront Distribution

Under CloudFront Section | Select Distribution tab | Click on Create Distribution

Under Create Distribution | Origin : Select your S3 Bucket and put same name | Click on create Distribution

After 5-10 minutes , Your Cloud Distribution Status will be enabled

Now Access your Cloud front URL from Web Browser | add /index.html after URL

Step 3: Launch EC2 Instance

Go to AWS Service | Click EC2 | and Select launch Instances | Under it Select Amazon Linux 2 AMI

Choose Instance Type t2.micro | Select Next: Configure Instance Details 

Scroll at end of page and under Advance : User data Section put below Code.

#!/bin/bash
yum update -y
yum install -y httpd.x86_64
systemctl start httpd
systemctl enable httpd
echo "

Hello, this index.html page from $(hostname -f)

" > /var/www/html/index.html
echo "

Hello, this index2.html page from $(hostname -f)

" > /var/www/html/index2.html

Click on Next : Add Storage

Select Default value of Storage | and Click to next Add tags | Under Tag Section | Put key : name and value : DclessonsEC2 | Click Next: Configure Security Policy


Comment

    You are will be the first.

LEAVE A COMMENT

Please login here to comment.