The following instructions show the deployment to an AWS account with the default setup (Default VPC).
1export AWS_ACCESS_KEY_ID="<PASTE_ACCESS_KEY>"2export AWS_SECRET_ACCESS_KEY="<PASTE_SECRET_ACCESS_KEY>"3export AWS_DEFAULT_REGION="<PASTE_DEFAULT_REGION (e.g., eu-central-1)>"
Navigate to the root folder of your code project. It will contain the following items.
1.env2.gitignore3Task4package.json5template.yaml
Run the deployment command:
1npm run deploy
Save the EventBusArn
, EventBusName
, and PostgresEndpoint
printed in the CloudFormation output.
1Key EventBusName2Description -3Value Taskbricks-EventBus456Key PostgresEndpoint7Description -8Value taskbricks.XXXXXXXXXXXX.eu-central-1.rds.amazonaws.com91011Key EventBusArn12Description -13Value arn:aws:events:eu-central-1:XXXXXXXXXXXX:event-bus/Taskbricks-EventBus
The Bounded Context Infrastructure Stack consists of two components:
Navigate to the Task subfolder. It should look like this:
1.env2.env-test3openapi.yaml4package.json5src6template.yaml7tests8tsconfig.build.json9tsconfig.json
Set these values in the .env
file:
1POSTGRES_URL="postgres://username:password@<POSTGRES_ENDPOINT>/postgres"2EVENT_BUS_ARN="<EVENT_BUS_ARN>"3EVENT_BUS_NAME="<EVENT_BUS_NAME>"4JWT_SECRET="<JWT_SECRET>"
<POSTGRES_ENDPOINT>
with the PostgresEndpoint
output of the Bounded Context Deployment<EVENT_BUS_ARN>
with the EventBusArn
output of the Bounded Context Deployment<EVENT_BUS_NAME>
with the EventBusName
output of the Bounded Context Deployment<JWT_SECRET>
with the output of JWT Secret Generator or similar.Run the build command:
1npm run build
Run the deployment command:
1npm run deploy
Save the ApiGatewayEndpoint
printed in the CloudFormation output.
1Key ApiGatewayEndpoint2Description -3Value https://XXXXXXXXXX.execute-api.eu-central-1.amazonaws.com/Prod
An Aggregate Infrastructure Stack consists of the following components:
ApiGatewayEndpoint
from the previous step into the openapi.yaml
under server -> url
1servers:2 - url: https://domainname.com
https://domainname.com
with https://XXXXXXXXXX.execute-api.eu-central-1.amazonaws.com/Prod
openapi.yaml
file