A CDN represents an Amazon CloudFront distribution. Amazon CloudFront is a service that uses AWS Edge Locations to speed up distribution of your web content. An edge location is a data center located in a major city, that caches your data. The edge location that provides the best performance for your end user retrieves, stores, and serves your web content to your user.
Key Features of Amazon CloudFront include:
- Highly available and secure edge locations
- Pay as you go, no upfront costs
- Ability to add, remove, or replace specific content to distribute
A CDN can be connected to an Object Store to access your static or dynamic web content. The CDN is granted read access to all objects in the Object Store, regardless of the Object Store's Public Permissions property.
Event subscription wires (solid line) connect two or more resources and are required to accomplish certain tasks or improve performance within an application's flow.
The following resources can be subscribed to a CDN:
- Object Store
Human readable name for this resource that is displayed on the Stackery Dashboard and Stackery CLI output.
Use Custom Domain
By default, Stackery will automatically create a domain for the CDN. This domain will be hosted under stackery-stacks.io.
The domain name that will be used for the CDN. AWS Certificate Manager will provision an SSL certificate for this domain. In order to provision the certificate, AWS will send an email to the domain's registration contacts and certain well-known domain administration email addresses:
When deploying be sure to check these email addresses to approve the certificate. If the domain is not verified within one hour of the start of the deployment the deployment will fail and be rolled back automatically.
The CDN domain name must be globally unique - specifically across AWS CloudFront Distributions and AWS API Gateway Custom Domains.
After deployment a CNAME DNS record will need to be created for the domain. Select the current deployment of your stack, then select your CDN resource on the Stackery Dashboard. Find and copy the DNS Name value in the properties panel on the right. Create a CNAME record to map the custom domain to this DNS name. Check with your DNS provider for instructions on how to create the record.
Enable Root Object
By default, visitors to the root of the CDN domain will receive a 404 Not Found message because there is no file in the Object store for the root. Enabling a root object allows for proxying requests to the root of the CDN domain to a specific file, such as /index.html.
When a root object is enabled, this value specifies the location of the root object to be proxied.
When connected by a service discovery wire (dashed wire), a Function or Docker Task will add the following IAM policy to its role and gain permission to access this resource.
No Permissions Added
When connected by a service discovery wire (dashed wire), a Function or Docker Task will automatically populate and reference the following environment variables in order to interact with this resource.
No Environment Variables Added
Related AWS Documentation
AWS Documentation: AWS::CloudFront::Distribution