question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

aws-cloudfront needs love

See original GitHub issue

We should redesign the API for the aws-cloudfront construct library. There’s a lot we can do in order to make it friendlier, less error-prone and less flat and declarative. At the moment, it’s basically “leaking” the low level API provided by CloudFormation.

Furthermore, it would be awesome if one could use Assets to point to a local directory that includes the web distribution content and have the toolkit do the work of uploading it to S3 and all that.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:16
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
PaulMaddoxcommented, Aug 21, 2018

For reference, this is what the current API looks like just to setup a simple SPA/PWA:

const bucket = new s3.Bucket(this, 'WebsiteBucket', {
    bucketName: 'pmaddox-website-bucket',
    versioned: true,
});

const originId = new cloudfront.cloudformation.CloudFrontOriginAccessIdentityResource(this, 'OriginAccessIdentity', {
    cloudFrontOriginAccessIdentityConfig: {
        comment: 'A comment to associate with this CloudFront origin access identity',
    }
});

const cert = acm.Certificate.import(this, 'ExistingCertificate', {
    certificateArn: new acm.CertificateArn('arn:aws:acm:us-east-1:123456789012:certificate/7d3591e4-de7f-45cf-f8f5-7cc3d1732930'),
});

const distribution = new cloudfront.CloudFrontWebDistribution(this, 'WebsiteDistribution', {
    aliasConfiguration: {
        names: ['my-website.com', 'www.my-website.com'],
        acmCertRef: cert.certificateArn,
    },
    originConfigs: [{
        behaviors: [{
            isDefaultBehavior: true,
        }],
        s3OriginSource: {
            originAccessIdentity: originId,
            s3BucketSource: bucket,
        },
    }]
})

The new API should improve the linking of S3 buckets to CloudFront distributions, and abstract away the need to explicitly create a CloudFrontOriginAccessIdentityResource.

It would be really nice if we could tie this in with #605 to handle certificate generation/validation too.

Furthermore, it would be awesome if one could use Assets to point to a local directory that includes the web distribution content and have the toolkit do the work of uploading it to S3 and all that.

👍

4reactions
njlynchcommented, Aug 21, 2020

The “love” this module needs was designed in this RFC (https://github.com/aws/aws-cdk-rfcs/issues/171) and implementation of the initial “Developer Preview” version is being tracked via this milestone: https://github.com/aws/aws-cdk/milestone/5.

There is also the overall tracking issue #6490 where high-level feature work can be tracked.

Closing this issue out in favor of the above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Amazon CloudFront Customers
We love how easy it is to set up a distribution, having the full control over the features, as well as the seamless...
Read more >
Lessons from Rolling out CloudFront on top of a Static S3 Site
However, AWS S3 hosting currently does not support SSL certificates, and thereby HTTPS connections. Because of this, we need to plop one ...
Read more >
Why You Shouldn't Use AWS S3 or CloudFront to Deliver ...
But S3, the most popular solution for storing on the cloud and the one everyone loves, should not always be your choice. In...
Read more >
Installing Godaddy SSL Certificates on AWS Cloudfront
... SSL certificate on to Amazon's Cloudfront CDN network is briefly explained here and meant to be a quickstart guide for those that...
Read more >
Find Answers to AWS Questions about Amazon CloudFront
meta.url); var AWS = require('aws-cloudfront-sign'); export const handler = async(event) => { var signingParams = ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found