Aws - Cloudfront

Card Puncher Data Processing

About

Amazon CloudFront is the CDN offering of AWS

Concept

Distribution

A distribution got all parameters of a web site (where the data comes from, certificate, …)

Aws Cloudfront Distribution

Management

Create origin-access-identity

aws cloudfront create-cloud-front-origin-access-identity --cloud-front-origin-access-identity-config CallerReference=Mysfits,Comment=Mysfits
{
    "CloudFrontOriginAccessIdentity": {
        "CloudFrontOriginAccessIdentityConfig": {
            "Comment": "Mysfits", 
            "CallerReference": "Mysfits"
        }, 
        "S3CanonicalUserId": "ABCABCCCAfICCQD6m7oRw0uXOjANBgkqhkiG9w0BAQUFADCBiDELMAkGA1EXAMPLE", 
        "Id": "CLOUDFRONT_ORIGIN_ACCESS_IDENTITY_ID"
    }, 
    "ETag": "ANPAJ2UCCR6DPCEXAMPLE", 
    "Location": "https://cloudfront.amazonaws.com/2017-10-30/origin-access-identity/cloudfront/ANPAJ2UCCR6DPCEXAMPLE"
}

Cloudfront Origin Access Identity

Create a distribution

  • After CloudFront creates your distribution, the value of Status will change from In Progress to Deployed.
  • Note the DomainName as that will be your web site.
  • If this is a web site used for more than just testing you should enable logging, and consider the AWS Web Application Firewall (WAF) service to help protect. For more information: Values That You Specify When You Create or Update a Web Distribution

Example on how to Create a CloudFront distribution, and configure the S3 bucket as the origin . The caller reference is created with the origin-access-identity

{
  "CallerReference": "REPLACE_ME_CLOUDFRONT_CALLER_REFERENCE",
  "Aliases": {
    "Quantity": 0
  },
  "DefaultRootObject": "index.html",
  "Origins": {
    "Quantity": 1,
    "Items": [
      {
        "Id": "REPLACE_ME_CLOUDFRONT_CALLER_REFERENCE",
        "DomainName": "REPLACE_ME_BUCKET_NAME.s3.amazonaws.com",
        "S3OriginConfig": {
          "OriginAccessIdentity": "origin-access-identity/cloudfront/REPLACE_ME_CLOUDFRONT_ORIGIN_ACCESS_IDENTITY_ID"
        }
      }
    ]
  },
  "DefaultCacheBehavior": {
    "TargetOriginId": "REPLACE_ME_CLOUDFRONT_CALLER_REFERENCE",
    "ForwardedValues": {
      "QueryString": true,
      "Cookies": {
        "Forward": "none"
      }
    },
    "TrustedSigners": {
      "Enabled": false,
      "Quantity": 0
    },
    "ViewerProtocolPolicy": "allow-all",
    "MinTTL": 0,
    "MaxTTL": 0,
    "DefaultTTL": 0
  },
  "CacheBehaviors": {
    "Quantity": 0
  },
  "Comment": "",
  "Logging": {
    "Enabled": false,
    "IncludeCookies": true,
    "Bucket": "",
    "Prefix": ""
  },
  "PriceClass": "PriceClass_All",
  "Enabled": true
}
aws cloudfront create-distribution --distribution-config file://pathToMyFile/website-cloudfront-distribution.json

List distribution

aws cloudfront list-distributions
{
    "DistributionList": {
        "Items": [
            {
                "Id": "E2E1NPPMOAPD5N",
                "ARN": "arn:aws:cloudfront::REPLACE_ME_ACCOUNT_ID:distribution/E2E1N6EEEAPD5N",
                "Status": "Deployed",
                "LastModifiedTime": "2019-04-08T17:47:49.770Z",
                "DomainName": "dyxpld3sqxwc9.cloudfront.net",
                "Aliases": {
                    "Quantity": 0
                },
                "Origins": {
                    "Quantity": 1,
                    "Items": [
                        {
                            "Id": "Mysfits",
                            "DomainName": "web-app-modern.s3.amazonaws.com",
                            "OriginPath": "",
                            ...............

Update distribution

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/HowToUpdateDistribution.html

Testing a distribution

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-testing.html

Documentation / Reference





Discover More
Map Of Internet 1973
A Content delivery network delivers Static resources such as image locally worldwide

A description for the search page result engine
Aws Moder App Mysfits Home Page
Aws - Modern Web App Workshop

Note the Aws project Build a Modern Web Application Code: aws-samples/aws-modern-application-workshop/tree/python...
S3 Bucket Public Access
Aws - Static Web Hosting

Static Web Hosting in Aws is done via s3 URL http://{your-bucket-name}.s3-website.{region}.amazonaws.com From the Aws...
Card Puncher Data Processing
Web Analytics - Pixel (1×1 gif, Clear Gif)

Tracking pixels (aka beacon, 1×1 gif, or clear gif) is a tracker that allow for tracking where a POST requests are disallowed (mostly to track Open Email), but where you can embed an image that will perform...



Share this page:
Follow us:
Task Runner