Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const AWS = require('aws-sdk');
- const { Client } = require('pg')
- const ssm = new AWS.SSM();
- const params = {
- Name: 'config',
- WithDecryption: false
- };
- ssm.getParameter(params, function(err, data) {
- if (err) {
- console.log(err, err.stack);
- } else {
- const config = JSON.parse(data.Parameter.Value);
- const client = new Client({
- user: config.user,
- host: config.host,
- database: config.database,
- password: config.password,
- port: config.port
- })
- client.connect()
- client.query('SELECT NOW()', (err, res) => {
- console.log(err, res)
- client.end()
- })
- }
- });
Add Comment
Please, Sign In to add comment