In this demo, we will:
1. Create an S3 bucket and upload a sample HTML file.
2. Create a CloudFront distribution.
3. Configure the S3 bucket for CloudFront access.
4. Test the CloudFront distribution.
5. Enable additional CloudFront features.
6. Clean up resources.
my-cloudfront-demo-bucket-297312
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CloudFront Demo</title>
</head>
<body>
<h1>Hello from CloudFront!</h1>
<p>This content is being served through Amazon CloudFront.</p>
</body>
</html>
{
"Version": "2008-10-17",
"Id": "PolicyForCloudFrontPrivateContent",
"Statement": [
{
"Sid": "AllowCloudFrontServicePrincipal",
"Effect": "Allow",
"Principal": {
"Service": "cloudfront.amazonaws.com"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-cloudfront-demo-bucket-567444/*",
"Condition": {
"StringEquals": {
"AWS:SourceArn": "arn:aws:cloudfront::651623850282:distribution/E1P8MNW9G4879Z"
}
}
}
]
}
Copy Distribution URL
http will get automatically redirected to https