Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import * as AWS from 'aws-sdk';
  2.  
  3. const ssm = new AWS.SSM();
  4.  
  5. export async function handler(event: any) {
  6. const id = event.pathParameters.id;
  7.  
  8. var ssmSecureParam1 = await ssm.getParameter({
  9. Name: '/CDK/Sample/SecureParam1',
  10. WithDecryption: true,
  11. }).promise();
  12.  
  13. let secureParam1: string = 'Unkown';
  14. if (ssmSecureParam1.Parameter != null && ssmSecureParam1.Parameter.Value != null) {
  15. secureParam1 = ssmSecureParam1.Parameter.Value;
  16. }
  17.  
  18. return {
  19. statusCode: 200,
  20. body: JSON.stringify({
  21. normal_param1: process.env.NORMAL_PARAM1,
  22. secure_param1: secureParam1,
  23. message: `request id: ${id}`,
  24. }),
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement