Create an opionated fun-stack app environment on AWS. With website, auth, and reactive api.
This repository contains reusable terraform modules to build this app.
Example on how to use it:
- Fun Scala Template: example
SDK library to communicate with the infrastructure in your code:
- Fun SDK Scala: sdk-scala
See local development module for mocking the AWS infrastructure locally:
- Fun Local Environment: local-env
- terraform (>= 1.3.0)
Use it in your terraform deployment as a module. Check out: Examples
For the custom domain: Either register the domain in AWS or create a hosted zone in AWS (then set the Nameservers at your registrar to the values you get from the following command):
aws route53 create-hosted-zone --name <my-domain> --caller-reference $(date +%s)
Run:
terraform init
terraform apply
Go to <my-domain>
in your browser.
You can have multiple environments, like dev,staging,prod. Just set stage = "<dev|staging|prod>"
. These environents can be available online at <stage>.env.<my-domain>
.
There are some errors that can occur, when switching between different configurations and/or updating the terraform module.
Error:
error getting Cognito User Pool UI customization (UserPoolId: eu-central-1_8XFDUWI6X, ClientId: 7sqg5mh9ou6f917imeh0fskav8): InvalidParameterException: There has to be an existing domain associated with this user pool
Solution:
terraform state rm $(terraform state list | grep -F ".module.auth[0].aws_cognito_user_pool_ui_customization.hosted_ui[0]")
Error:
error updating CloudFront Distribution (E290PULR94BUXK): PreconditionFailed: The request failed because it didn't meet the preconditions in one or more request-header fields.
Solution:
terraform apply # just retry
Cognito user-pool with hosted UI.
(Authorized) Websocket with API Gateway.
(Authorized) Http with API Gateway.
Cloudfront, backed by s3 bucket.