Skip to content

A REST echo server used for the Nordic Developer Academy developed using AWS CDK in TypeScript.

License

Notifications You must be signed in to change notification settings

bifravst/rest-echo

REST echo server

GitHub Actions semantic-release Renovate @commitlint/config-conventional code style: prettier ESLint: TypeScript

A REST echo server used for the Nordic Developer Academy developed using AWS CDK in TypeScript.

Installation in your AWS account

Setup

Provide your AWS credentials.

Install the dependencies:

npm ci

Configure Metrics (optional)

Configure the metrics for Azure Monitor logs ingestion (used for usage metrics tracking):

aws ssm put-parameter --name /${STACK_NAME:-rest-echo}/metrics/endpoint --type String --value "<endpoint>"
aws ssm put-parameter --name /${STACK_NAME:-rest-echo}/metrics/dcrId --type String --value "<dcrId>"
aws ssm put-parameter --name /${STACK_NAME:-rest-echo}/metrics/streamName --type String --value "<streamName>"
aws ssm put-parameter --name /${STACK_NAME:-rest-echo}/metrics/secret --type SecureString --value "<secret>"

Deploy

npx cdk bootstrap # if this is the first time you use CDK in this account
npx cdk deploy

Usage

Once the API is deployed, you can interact with it as documented here.

Both non-secure HTTP and secure HTTPs are supported.

Continuous Deployment with GitHub Actions

Create a GitHub environment production.

Store the role used for continuous deployment as a secret:

CD_ROLE_ARN=`aws cloudformation describe-stacks --stack-name ${STACK_NAME:-rest-echo} | jq -r '.Stacks[0].Outputs[] | select(.OutputKey == "cdRoleArn") | .OutputValue'`
gh secret set AWS_ROLE --env production --body "${CD_ROLE_ARN}"

Store the stack name and the region as a variable:

gh variable set STACK_NAME --env production --body "${STACK_NAME:-rest-echo}"
gh variable set AWS_REGION --env production --body "${AWS_REGION}"

Optionally, if you are using a custom domain name, store the domain name and the AWS certificate ID:

gh variable set DOMAIN_NAMES --env production --body "rest.nordicsemi.academy,echo.thingy.rocks"
gh variable set CERTIFICATE_ID --env production --body "ff6dc724-ac8d-4328-8f86-628126771d67"

CI

We use bifravst/ci to set up resources and permissions for continuous integration.

About

A REST echo server used for the Nordic Developer Academy developed using AWS CDK in TypeScript.

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •