AWS Serverless Sharing Configuration Data
Sharing Configuration Data in a Serverless Environment
In a microservice architecture, communication between services and functions is critical.
A service requires configuration or connection data to communicate with another service.
Handling configuration data or secrets in code is a common problem for developers.
These include connection strings, logging options, and outputs.
This data may be sensitive, so don't unintentionally check it into source code or distribute it.
When working with sensitive data such as configuration data, there are several deployment options:
- This data can be hardcoded in your code
- You can use environment variables
- You can use the runtime load of this data
Never hardcode secrets or configuration data in your application code.
Loading data at runtime increases latency, keeping sensitive data out of your code.
It is a best practice.
Sharing Configuration Data in a Serverless Environment Video
W3schools.com collaborates with Amazon Web Services to deliver digital training content to our students.
An Environment variable is a dynamically named item that can change how a program behaves.
When using Lambda, keep configuration parameters separate from your code.
AWS Key Management Service can encrypt these values.
Because environment variables are function-specific, setting up Lambda functions is impossible.
Environment variables must be updated in all Lambda functions using them.
AWS Systems Manager Parameter Store
One solution for configuration data is AWS Systems Manager Parameter Store.
It is a free, fully managed, centralized storage system for configuration data management.
Parameter Store tracks all parameter changes through versioning.
Never keep sensitive data in code or environment variables.
Use Systems Manager Parameters to store your secrets and shared configuration settings.
However, Parameter Store may increase latency.
Therefore, you should benchmark your function to identify the best technique.
One of the techniques to address performance issues is using AWS X-Ray.
Related reads:What Is AWS Secrets Manager?
AWS Systems Manager FAQs
Sharing Secrets with AWS Lambda Using AWS Systems Manager Parameter Store
AWS Lambda Environment Variables