aws-amplify / aws-amplify/amplify-hosting
[Feature Request] Support for Lambda Secrets extension for SSR environments
- Dominant language
- Dockerfile
- Stars
- 481
- Forks
- 123
- PR merge metrics
- No merged PRs in 30d
Description
### Before opening, please confirm:
- [X] I have checked to see if my question is addressed in the [FAQ](https://github.com/aws-amplify/amplify-hosting/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-hosting/issues?q=is%3Aissue+).
- [X] I have removed any sensitive information from my code snippets and submission.
### Amplify Hosting feature
Access control, Environment variables, SSR
### Is your feature request related to a problem? Please describe:
Currently, there is no way to pass secret values to SSR environments. The only available way to pass any variables at all is via `.env` files [^1]. This way is not secure, because secrets will be stored in plain text in the `.env` file and can be found in downloaded build artefact.
[^1]: https://docs.aws.amazon.com/amplify/latest/userguide/ssr-environment-variables.html
### Describe how you'd like this feature to work
Taking into account that SSR applications are running as Lambdas, the ideal solution would be (if architecture allows it) to enable Lambda Extension[^2][^3] for reading secrets[^4][^5]. This will allow accessing secrets in secure way without need to add AWS SDK to the application bundle.
[^2]: https://aws.amazon.com/blogs/compute/introducing-aws-lambda-extensions-in-preview/
[^3]: https://docs.aws.amazon.com/lambda/latest/dg/lambda-extensions.html
[^4]: https://aws.amazon.com/blogs/compute/using-the-aws-parameter-and-secrets-lambda-extension-to-cache-parameters-and-secrets/
[^5]: https://docs.aws.amazon.com/systems-manager/latest/userguide/ps-integration-lambda-extensions.html
Then secrets can be accessed as simply as:
```
GET http://localhost:port/systemsmanager/parameters/get?name=parameter-name&version=version&label=label&withDecryption={true|false}
```
This will likely be possible only once IAM roles for SSR environments are released:
- https://github.com/aws-amplify/amplify-hosting/issues/3205
### Related issues:
- https://github.com/aws-amplify/amplify-backend/issues/1052
- https://github.com/aws-amplify/amplify-hosting/issues/2874
- https://github.com/aws-amplify/amplify-hosting/issues/3966
- https://github.com/aws-amplify/amplify-hosting/issues/4044
Contributor guide
Research direction
Start by reviewing the IAM roles prerequisite in issue #3205 and the related Amplify Hosting and backend issues, then compare the SSR environment architecture with the referenced AWS Lambda Extensions documentation. Done means the requested secret access approach is defined and supported for SSR environments without storing secrets in downloaded build artifacts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws
- Domain
- cloud, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100