AWS Systems Manager (SSM) Parameters Store and Access using Lambda Function (Node/Javascript)

a. Store Key and Values Pairs
b. Store environment variables that are going to be used in different AWS services like — AWS Lambda, Amazon EC2
c. We can also Update/Access these variables from Lambda functions
  1. Create Parameter in SSM first
  2. Create New IAM permission for accessing SSM parameters(Variable) from lambda
  3. Create Lambda function: use SSM Javascript SDK to read/update SSM parameters

1. Create Parameter in SSM first

Click On Parameter store
Create New Parameter

2. To access/update SSM parameter from lambda need to give Permission:

Click next
Next => Next
Create Role

3. Now want to access and update these Parameters from lambda function?

Click: Create a Lambda function name: ssmParameterLambda
a.  await ssm.putParameter(params).promise();
b. const data= await ssm.getParameters({
Names: [`/my-app/staging/userName`]
}).promise();
exports.handler = async (event) => {
const ssm = new (require('aws-sdk/clients/ssm'))()
var params = {
Name: '/my-app/staging/userName',
Value: 'Changed to Shivam Gupta',
Overwrite: true,
Type: 'String'
};

// Update existing userName
await ssm.putParameter(params).promise();
const data= await ssm.getParameters({
Names: [`/my-app/staging/userName`]
}).promise();

const response = {
statusCode: 200,
body: data,
};
return response;
};
What is AWS Systems Manager? https://docs.aws.amazon.com/systems-manager/latest/userguide/what-is-systems-manager.htmlAWS SDK for JavaScript — https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SSM.html#getParameters-propertyhttps://docs.aws.amazon.com/AmazonCloudWatch/latest/events/RunLambdaSchedule.html

--

--

--

Full Stack Engineer (Web/App) working on different JS Technologies & frameworks— Angular, Node, Typescript, Ionic, Firebase, AWS, ElK...Love to write cool stuff

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

AWS is Chasing Engineers

Top 5 Reasons to Choose .NET for Your IoT Project

Design & Debug REST APIs like a Pro Team.

Working in Notion | Part 1

How to Use Data Binding in Android

Deploy a Django app on Heroku using GitHub

Data Replication from PostgreSQL to Snowflake with Python

everyday data engineering — data replication from postgresql to snowflake with python

CS 100.2: Big O

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Shivam Gupta

Shivam Gupta

Full Stack Engineer (Web/App) working on different JS Technologies & frameworks— Angular, Node, Typescript, Ionic, Firebase, AWS, ElK...Love to write cool stuff

More from Medium

CI/CD Storybook project to S3 static website by integrating AWS CodePipeline with GitHub

Connect to AWS Aurora Serverless DB using DBeaver

Achieving modern authorization

How does Shopify routes Traffic?