Website
Resource Overview
A Website represents a CodeBuild job that builds a static website and publishes it to an S3 Bucket.
Key Features of a Website resource includes:
- Fetches the source code
- Installs build dependencies
- Runs build command
- Publishes built files to the specified destination object store
Stackery automatically installs any permissions necessary for the CodeBuild job to run.
IMPORTANT : Because the CodeBuild job fetches the source code for the static Website, you must use the CodeBuild strategy to deploy a stack that contains a Website resource.
Event Subscription
Event subscription wires (solid line) visualize and configure event subscription integrations between two resources.
The following resources can be subscribed to the Destination Object Store facet:
- Object Store
IMPORTANT : You'll also need to enable website hosting on the object store or connect a CDN resource to it.
Service Discovery
A Website resource is considered a Compute Resource; it adopts the permissions and environment variables required to perform actions using cloud resources within the stack. This occurs when a service discovery wire (dashed line) is connected from the References facet to another cloud resource.
Website resources are capable of environment-aware service discovery and permission scoping for the following resources:
- Function
- Docker Task
- GraphQL API
- Job Queue
- Object Store
- PubSub Topic
- REST API
- Stream
- Table
- Virtual Network (resources within a Virtual Network)
Configurable Properties
Logical ID
The unique identifier used to reference this resource in the stack template. Defining a custom Logical ID is recommended, as it allows you to quickly identify a resource and any associated sub-resources when working with your stack in AWS, or anywhere outside of the Stackery Dashboard. As a project grows, it becomes useful in quickly spotting this resource in template.yaml
or while viewing a stack in Template View mode.
The Logical ID of all sub-resources associated with this Website will be prefixed with this value.
The identifier you provide must only contain alphanumeric characters (A-Za-z0-9) and be unique within the stack.
Default Logical ID Example: Website2
IMPORTANT : AWS uses the Logical ID of each resource to coordinate and apply updates to the stack when deployed. On any update of a resource's logical ID (or any modification that results in one), CloudFormation will delete the currently deployed resource and create a new one in it's place when the updated stack is deployed.
Source Directory
The directory that contains the code for your static Website. It is relative to the root of your project.
Build Command
The command to run in order to build your static Website.
Publish Directory
The directory that contains the built static Website after the Build Command is run. It is relative to the root of your project.
Environment Variables
Environment variables are key-value pairs that enable users to define variables in the runtime environment that will dynamically populate in your Website. Environment variables are automatically populated when you connect a service discovery wire (dashed wire) from the Website References to another Cloud Resource. You also have the ability to manually define these environment variables that your Website CodeBuild job requires.
IAM Permissions
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
Environment Variables
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.
WEBSITE_BUILDER_PROJECT_NAME
The CodeBuild Project Name.
WEBSITE_BUILDER_PROJECT_ARN
The Amazon Resource name of the CodeBuild Project.
Metrics & Logs
Double clicking a resource while viewing your stack's current deployment gives you access to your pre-configured resource properties.
Double click on the S3 Bucket attached to the Destination Object Store facet to view the
- Website Hosting Address
If you are using a CDN, double click on the CDN resource to view the
- Distribution DNS Name
Related AWS Documentation
AWS Documentation: AWS::CodeBuild::Project