AWS CDK: Read data from AWS Parameter Store

February 11th, 2020 104 Words

When you orchestrate an architecture von AWS, you’ll often end up with the need to read information like hostnames, identifiers, resource names or ARNs from somewhere for further processing. CloudFormation Stacks can have configured Outputs and Parameters, but using the AWS Parameter Store proved to be a more flexible solution. Using the AWS Cloud Development Kit in TypeScript, you can easily read data from AWS Parameter Store.

import * as CDK from "@aws-cdk/core";
import * as SSM from "@aws-cdk/aws-ssm";

export class ParameterStack extends CDK.Stack {
  constructor(app: CDK.App, id: string, props?: CDK.StackProps) {
    super(app, id, props);

    const value = SSM.StringParameter.valueForStringParameter(