API Gateway -> Parameter Store

This article walks through how to use API Gateway to fetch values directly from SSM Parameter Store


  • General knowledge of AWS CDK
  • General knowledge of API Gateway
  • General knowledge of SSM Parameter Store
  • General knowledge of Apache Velocity

Basic Setup

This snippet does the following:

  • Create a new parameter
  • Create a new API Gateway
  • Create a new IAM role with permission to read the parameter
  • Create a new Resource on the api

Method Integration

Now that we have the basic structure of our API, we need to add an Method and Integration to the resource we created.

Add the following to our project:


This uses a Mapping Template in the integration response to drill into the response from the GetParameter call.

This let's us fetch the parameter value from a response like this:


We can make a few improvements to this implementation by abstracting our functionality into another CDK construct:

Now we can update our original stack with the following: