How to use the SSM function from aws-sdk

Find comprehensive JavaScript aws-sdk.SSM code examples handpicked from public code repositorys.

The AWS SDK SSM (Systems Manager) is a service that provides a unified user interface that allows you to view and control your infrastructure on AWS.

6
7
8
9
10
11
12
13
14
15

const cwEvents = new AWS.CloudWatchEvents({
  endpoint: process.env.CLOUDWATCH_ENDPOINT_URL
})
const s3 = new AWS.S3({ endpoint: process.env.S3_ENDPOINT_URL })
const ssm = new AWS.SSM({ endpoint: process.env.SSM_ENDPOINT_URL })

const log = require('./log')

const itemStoreBucket = process.env.ITEM_STORE_BUCKET
fork icon21
star icon48
watch icon8

6
7
8
9
10
11
12
13
14
15
16
17
18


'use strict';


const AWS = require('aws-sdk');
const DynamoDB = new AWS.DynamoDB.DocumentClient();
const SSM = new AWS.SSM();
const APIGatewayManagement = new AWS.ApiGatewayManagementApi({apiVersion: '2018-11-29'});


const readSessionFromSSM = function (callback) {
    let param = {
fork icon7
star icon22
watch icon0

How does aws-sdk.SSM work?

The AWS SDK SSM (Systems Manager) service provides APIs for configuring and managing EC2 instances and on-premises servers, including collecting software inventory, applying operating system patches, creating system images, and configuring instances and applications at scale.

15
16
17
18
19
20
21
22
23
24
const zipLocal = require("zip-local");


const AWS = require('aws-sdk');
const lambda = process.env.METRICS == "true" ? new AWS.Lambda({ customUserAgent: process.env.SOLUTION_IDENTIFIER, region: 'us-east-1' }) : new AWS.Lambda({ region: 'us-east-1' });
const ssm = process.env.METRICS == "true" ? new AWS.SSM({ customUserAgent: process.env.SOLUTION_IDENTIFIER }) : new AWS.SSM();
const wafv2 = process.env.METRICS == "true" ? new AWS.WAFV2({ customUserAgent: process.env.SOLUTION_IDENTIFIER, region: 'us-east-1' }) : new AWS.WAFV2({ region: 'us-east-1' });


exports.handler = async (event, context) => {
fork icon5
star icon12
watch icon15

66
67
68
69
70
71
72
73
74
75
  numbers: true,
  symbols: "!@#$%^&*()_+-=[]{}|",
  strict: true,
});

const ssm = new AWS.SSM({ region: "us-east-1" });

let connectssmparameter = await ssm
  .getParameter({
    Name: CONNECT_SSM_PARAMETER,
fork icon4
star icon30
watch icon3

+ 32 other calls in file

Ai Example

1
2
3
4
5
6
7
8
9
10
11
12
const AWS = require("aws-sdk");
const ssm = new AWS.SSM();

const parameterName = "/example/parameter";

ssm.getParameter({ Name: parameterName }, function (err, data) {
  if (err) {
    console.log("Error:", err);
  } else {
    console.log(`Value of ${parameterName}: ${data.Parameter.Value}`);
  }
});

This example creates a new SSM object from the aws-sdk, sets the name of the parameter to be retrieved, and then uses the getParameter() method to retrieve the value of the specified parameter from AWS SSM. If successful, the retrieved value is logged to the console.

4
5
6
7
8
9
10
11
12
13

// require('dotenv').config();
// const rdsDataService = new AWS.RDSDataService();

const getDatabaseName = async () => {
    const ssm = new AWS.SSM({region: 'us-east-1'});
    const dbParamKey = '/bookstore/db/name';

    const data = await new Promise((resolve, reject) => {
        ssm.getParameter({ Name: dbParamKey }, (err, data) => {
fork icon0
star icon2
watch icon1

28
29
30
31
32
33
34
35
36
37

    const lastForwardSlash = path.lastIndexOf('/');
    this.stackDir = lastForwardSlash > 0? path.slice(0, lastForwardSlash) : ".";
    
    this.events = new EventEmitter();
    this.ssm = new aws.SSM({ region: samconfig.region });
    this.cf = new aws.CloudFormation({ region: samconfig.region });
}

cleanup() {
fork icon1
star icon1
watch icon2

+ 28 other calls in file

17
18
19
20
21
22
23
24
25
26
27
var url = require('url');
var vpcutils = require('./vpcutils');
var SumoLogsClient = require('./sumo-dlq-function-utils').SumoLogsClient;
var Utils = require('./sumo-dlq-function-utils').Utils;
const AWS = require('aws-sdk');
const ssm = new AWS.SSM();


exports.getEndpointURL = async function() {
  console.log('Getting SUMO_ENDPOINT from AWS SSM Parameter Store');
  return new Promise((resolve, reject) => {
fork icon0
star icon1
watch icon1

61
62
63
64
65
66
67
68
69
})

var autoscaling = new AWS.AutoScaling()
const dynamodb = new AWS.DynamoDB()
var docClient = new AWS.DynamoDB.DocumentClient()
var SSM = new AWS.SSM()
var cloudwatch = new AWS.CloudWatch()
var message = 'ok'
var RequestType = 'events'
fork icon0
star icon1
watch icon0

170
171
172
173
174
175
176
177
178
179
  * @param {Array} ingestEndpoints
  *
  */
async writeToParameterStore(ingestEndpoints) {
  const secrets = [];
  const ssm = new SSM({ apiVersion: '2014-11-06' });
  const promises = ingestEndpoints.map((x, idx) => {
    const param = {
      Type: 'SecureString',
      Name: `${this.ssmKey}-${idx}`,
fork icon0
star icon0
watch icon1

+ 199 other calls in file

12
13
14
15
16
17
18
19
20
21
22
23
24


const s3 = new AWS.S3({
    region: 'us-east-1'
});


const ssm = new AWS.SSM({
    region: 'us-east-1'
});


async function readDragons() {
fork icon0
star icon0
watch icon0