I have an Altostra project with a Lambda function that listens on SNS topic, and needs to call another service using an API Token. I need to save the API Key as an env variable, how do I keep it encrypted?
Could anybody help me with that?
Thanks!

I have an Altostra project with a Lambda function that listens on SNS topic, and needs to call another service using an API Token. I need to save the API Key as an env variable, how do I keep it encrypted?
Could anybody help me with that?
Thanks!

It is not recommended to store sensitive data in an env variable, because it will be exposed to anyone who can access the Lambda. A better option is to store the API key in a SSM parameter. AWS SSM is a secured storage for sensitive data.
You can add a SSM parameter reference to an Altostra project and use it in the Lambda like so:


import { SSM } from 'aws-sdk';
const ssm = new SSM();
const param = await ssm.getParameter({
Name: 'api-key',
WithDecryption: true,
}).promise();