Skip to content

Instantly share code, notes, and snippets.

@Rud5G
Forked from cbschuld/parameterStore.ts
Created August 3, 2023 15:48
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 Rud5G/14550503ec52676257f7a0b298795b15 to your computer and use it in GitHub Desktop.
Save Rud5G/14550503ec52676257f7a0b298795b15 to your computer and use it in GitHub Desktop.
Obtain values from the AWS Parameter store with Typescript/node
import { SSM } from "aws-sdk";
const getParameterWorker = async (name:string, decrypt:boolean) : Promise<string> => {
const ssm = new SSM();
const result = await ssm
.getParameter({ Name: name, WithDecryption: decrypt })
.promise();
return result.Parameter.Value;
}
export const getParameter = async (name:string) : Promise<string> => {
return getParameterWorker(name,false);
}
export const getEncryptedParameter = async (name:string) : Promise<string> => {
return getParameterWorker(name,true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment