Using paths to create hierarchies in Parameter Store by Josh Sherman


Parameter Store only supports a limited number of characters for the parameter name. As per the error message you are presented with, Only a mix of letters,
numbers and the following 3 symbols .-_ are allowed.

What that error fails to mention is that you can actually use a fourth symbol, the forward slash, /.

That particular special character also unlocks some additional functionality within AWS Parameter Store. When you utilize the / character, you are creating a path, similar to paths on a Linux or Unix-based operating system.

This allows you to do things like group parameters for different environments, or whatever sort of hierarchy you’d like to impose on your Parameter Store parameters:


When you use the / you can still fetch the parameters with getParameter and
getParameters but the real magic happens when you use it getParametersByPath.

When getting parameters by their path, you can get all of the parameters at the depth of the path of your choosing:

import * as AWS from 'aws-sdk';

const ssm = new AWS.SSM();

const staging = await ssm.getParametersByPath(
	Path: '/Staging/',
	WithDecryption: true,

const stagingDataStores = await ssm.getParametersByPath(
	Path: '/Staging/Data_Stores/',
	WithDecryption: true,

const stagingDataStoreRedis = await ssm.getParametersByPath(
	Path: '/Staging/Data_Store/Redis_Elasticache',
	WithDecryption: true,

Good stuff? Want more?

Weekly emails about technology, development, and sometimes sauerkraut.

100% Fresh, Grade A Content, Never Spam.



Please enter your comment!
Please enter your name here