Cloud backend for
hello.nrfcloud.com/map
developed
using AWS CDK in
TypeScript.
Install the dependencies:
npm ci
The single-cell geo-location features uses the nRF Cloud Ground Fix API which requires the service to be enabled in the account's plan. Manage the account at https://nrfcloud.com/#/manage-plan.
Provide your nRF Cloud API key:
./cli.sh configure-nrfcloud-account apiKey <API key>
Some of the feature are run from docker containers, ensure they have been built and published before deploying the solutions.
export OPENSSL_LAMBDA_CONTAINER_TAG=$(./cli.sh build-container openssl-lambda)
# You can add these outputs to your .env file
echo OPENSSL_LAMBDA_CONTAINER_TAG=$OPENSSL_LAMBDA_CONTAINER_TAG
npx cdk bootstrap # if this is the first time you use CDK in this account
npx cdk deploy
You can specify a custom domain name for the deployed API using the environment
variable API_DOMAIN_NAME
.
If you do so, make sure to create a certificate in the region for this domain name.
After deploying the stack, make sure to set up a CNAME record for this domain
that points to the hostname of the deployed API (available in the stack output
gatewayDomainName
).
After deploying the stack manually once,
- configure a GitHub Actions environment named
production
- create the secret
AWS_ROLE
with the valuearn:aws:iam::<account ID>:role/<stack name>-cd
and a variable (use thecdRoleArn
stack output) - create the variable
AWS_REGION
with the value<region>
(your region) - create the variable
STACK_NAME
with the value<stack name>
(your stack name)
to enable continuous deployment.