Checkout the ServerlessLink website for a demo!
- This is used to install the AWS CLI and move the website assets into the S3 bucket
Alternatively you can use the
onema/userverless-build docker container to build and deploy your application:
docker run -it --rm -v $HOME/.aws/:/root/.aws/ -v $PWD:/root/app onema/userverless-build bash
You need a Route 53 hosted zone for the domain that you will be using in this project. This project assumes that
you will be using a second-level domain name e.g.
test.com as this name is used to look up the Route 53 hosted zone.
If you want to use a sub-domain e.g. link.test.com, you will need to modify the resources
ApiDomainRecordSet in the
link-resources_cfn.yml file to use the proper
See [AWS::Route53::RecordSet] and [Alias Resource Record Set for a CloudFront Distribution] for more information
Create the assembly
Deploy the code using serverless
serverless deploy --domain <DOMAIN_NAME>
The <DOMAIN_NAME> is the domain you will be using for your application. This will create a bucket with the given domain name and create two DNS Record Sets in Route 53, one for the website and another one for the API.
Serverless will use the file
infrastructure/link-resources_cfn.yml and generate the following resources:
- Website Bucket (to place the application files)
- DynamoDB table (where the link mappings are saved)
- ACM certificate for the Website
- ACM certificate for the API
- Domain Mapping for the API (the domain will be
- CloudFront distribution for the website
- Record set entry in Route 53 for the website
- Record set entry in Route 53 for the API
The process will not finished until the ACM Certificates have been approved, the approval process requires a DNS entry, you can see the instructions to add the DNS record in the ACM control panel.
To push the website code to the bucket use the following command
aws s3 cp ./public/ s3://<DOMAIN_NAME> --recursive
The application needs a
config.js file. You can copy the
All you need to fill in is the name of the
invokeUrl which is the URL of your API
m.<DOMAIN_NAME>, and the scheme, this should be
Optional setup Build/Deploy service for your application
I have included a cloud formation template
infrastructure/code-build-cicd_cfn.yml to generate a CodeBuild service.
This service can be used to deployed your serverless application any time you push code to a branch in your GitHub repository
(the branch is defined in the template parameters).