Skip to content

hello-nrfcloud/public-parameter-registry-aws

Public Parameter Registry for AWS

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

Public Parameter Registry for developed using AWS CDK in TypeScript.

This project provides a JSON file in a public S3 bucket, that contains all SSM Parameters under a path that starts with the name of this stack.

This is useful to publish for example resource endpoints without relying on AWS, or configuration settings for web applications without having to redeploy the application.

It is used in our projects to provide a way to share outputs from CloudFormation stacks without needed to depend on them directly. This also allows to have a web application, which might be hosted on a CDN and therefore only exists in on region, to consume stack outputs from backend stacks in multiple regions.

Installation in your AWS account

Setup

Provide your AWS credentials.

Install the dependencies:

npm ci

Deploy

# Optionally, configure the stack name to use a suitable name for your project:
export STACK_NAME="my-project-registry"
npx cdk deploy

Setting parameters

Use SSM:

aws ssm put-parameter --name /${STACK_NAME:-public-parameter-registry}/public/some-parameter --type String --value "Some Value"

For parameters to be published, they must be below the path /<stack name>/public/.

CD with GitHub Actions

Create a GitHub environment production.

Store the role name from the output as a GitHub Action secret:

CD_ROLE_ARN=`aws cloudformation describe-stacks --stack-name ${STACK_NAME:-public-parameter-registry} | jq -r '.Stacks[0].Outputs[] | select(.OutputKey == "cdRoleArn") | .OutputValue' | sed -E 's/\/$//g'`
gh variable set AWS_REGION --env production --body "${AWS_REGION}"
gh secret set AWS_ROLE --env production --body "${CD_ROLE_ARN}"
# If you've used a custom stack name
gh variable set STACK_NAME --env production --body "${STACK_NAME}"