Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

aws secret manager nodejs javascript

const AWS = require("aws-sdk");
const region = your region;

const credentials = new AWS.SharedIniFileCredentials({
  profile: "secret-manager",
});

AWS.config.credentials = credentials;

const client = new AWS.SecretsManager({
  region: region,
});

const createSecrets = async (params) => {
  const response = await new Promise((resolve, reject) => {
    client.createSecret(params, (err, result) => {
      if (err) reject(err);
      if (result) {
        resolve(result);
      }
    });
  });
  return response;
};

const getSecrets = async (SecretId) => {
  const response = await new Promise((resolve, reject) => {
    client.getSecretValue({ SecretId }, (err, result) => {
      if (err) reject(err);
      if (result) {
        resolve(result.SecretString);
      }
    });
  });
  return JSON.parse(response);
};

module.exports = { getSecrets, createSecrets };
Comment

aws secret manager nodejs

const AWS = require("aws-sdk");
const region = your region;

const credentials = new AWS.SharedIniFileCredentials({
  profile: "secret-manager",
});

AWS.config.credentials = credentials;

const client = new AWS.SecretsManager({
  region: region,
});

const createSecrets = async (params) => {
  const response = await new Promise((resolve, reject) => {
    client.createSecret(params, (err, result) => {
      if (err) reject(err);
      if (result) {
        console.log("result", result);
        resolve(result);
      }
    });
  });
  return response;
};

const updateSecrets = async (params) => {
  const response = await new Promise((resolve, reject) => {
    client.updateSecret(params, (err, result) => {
      if (err) reject(err);
      if (result) {
        resolve(result);
      }
    });
  });
  return response;
};

const getSecrets = async (SecretId) => {
  const response = await new Promise((resolve, reject) => {
    client.getSecretValue({ SecretId }, (err, result) => {
      if (err) reject(err);
      if (result) {
        resolve(result.SecretString);
      }
    });
  });
  return JSON.parse(response);
};

module.exports = { getSecrets, createSecrets, updateSecrets };
Comment

PREVIOUS NEXT
Code Example
Javascript :: generate otp using javascript 
Javascript :: javascript location href target _blank 
Javascript :: generate random number jquery 
Javascript :: regex for numbers and decimals only 
Javascript :: js for each element class 
Javascript :: how to vibrate phone using javascript 
Javascript :: a tag do nothing on click 
Javascript :: send a file ajax 
Javascript :: javascript open url 
Javascript :: javascript split get last element 
Javascript :: moment today date 
Javascript :: add classnames to body 
Javascript :: javascript isset 
Javascript :: copyright in javascript 
Javascript :: path.split is not a function react hook use form 
Javascript :: js fetch delete 
Javascript :: cdn opencv.js 
Javascript :: js create div 
Javascript :: js random id 
Javascript :: node read file line 
Javascript :: jquery get element id 
Javascript :: document get element by tag 
Javascript :: object key value as string ts type js 
Javascript :: how to get img dimensions from remote url js 
Javascript :: graphqlHTTP is not a function 
Javascript :: camera helper three js 
Javascript :: get the current url javascript 
Javascript :: dropzone clear files 
Javascript :: find last prisma 
Javascript :: numeros primos js 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =