Guest User

Untitled

a guest
Dec 16th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. const AWS = require('aws-sdk');
  2. const { Client } = require('pg')
  3.  
  4. const ssm = new AWS.SSM();
  5. const params = {
  6. Name: 'config',
  7. WithDecryption: false
  8. };
  9. ssm.getParameter(params, function(err, data) {
  10. if (err) {
  11. console.log(err, err.stack);
  12. } else {
  13. const config = JSON.parse(data.Parameter.Value);
  14.  
  15. const client = new Client({
  16. user: config.user,
  17. host: config.host,
  18. database: config.database,
  19. password: config.password,
  20. port: config.port
  21. })
  22. client.connect()
  23.  
  24. client.query('SELECT NOW()', (err, res) => {
  25. console.log(err, res)
  26. client.end()
  27. })
  28. }
  29. });
Add Comment
Please, Sign In to add comment