Skip to content

Instantly share code, notes, and snippets.

@carlovsk
Created January 29, 2022 02:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlovsk/ae4a18f44ee49c956febb167bc1eeeae to your computer and use it in GitHub Desktop.
Save carlovsk/ae4a18f44ee49c956febb167bc1eeeae to your computer and use it in GitHub Desktop.
import { SSMClient, GetParameterCommand } from '@aws-sdk/client-ssm'
const secretParameterNameBuilder = (name: string): string => `/env/${process.env.PROJECT_NAME}/${process.env.STAGE}/${name}`
export const getParameter = async (name: string): Promise<string> => {
const client = new SSMClient({})
const param = secretParameterNameBuilder(name)
const { Parameter: { Value } } = await client.send(new GetParameterCommand({
Name: param
}))
return Value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment