Getting Started
Prerequisites
- AWS Account
- IAM user with Power user rights
Needed Rights
Not all services are needed. But there a enough services for which access is needed, that using a Power User simplifies the user configuration. - AWS CLI
- AWS CLI named profile
- nvm
- NodeJS:
nvm install node
Domains
The domains need to be hosted in Route53. Cloudformation will automatically create the relevant Aliases.
You need to define 3 domains. One for each service. To make it easier, it is recommended to use sub-domains. But you don’t have too.
As example:
- Albums Manager: admin.gallery.example.com
- Image Resizer: img.gallery.example.com
- Public Site: gallery.example.com
Hosted Zone ID
Retrieve the HostedZoneId for each domain. You will need to paste it into the configuration files of each service.
HOSTEDZONEID=$(aws --profile myprofile route53 list-hosted-zones --query 'HostedZones[?Name==`example.com.`].Id' --output text | cut -d'/' -f3)
AWS Console
You can also retrieve the hostedZoneId from the AWS ConsoleMultiple domains
If you decided to use different base domains for your services, you will need to retrieve each HostedZoneId.ACM Certificates
ACM Certificates for Cloudfront need to be generated in us-east-1. And since Cloudformation isn’t able to easily do cross region stacks, we will create the certificates manually and only give their ARN as reference to our stacks.
Open ACM in us-east-1, generate a single certificate for gallery.example.com as primary domain and *.gallery.example.com as alternate domain. Use DNS as validation method, click the button to create the entries in Route53.
Keep the ARN (arn:aws:acm:us-east-1:AccountId:certificate/certificateId) somewhere.
Wait for the certificate to be valid.
Multiple domains
If you decided to use different base domains for your services, you will need to create multiples certificates and keep each of the ARN’s.Amplify
If you haven’t already setup Amplify:
npm install -g @aws-amplify/cli
amplify configure
AWS Region
The services don’t need to be in the same region. But it is highly recommended, mainly for imageResize and publicsite to be in the same region.