Feature request: Put parameter
Use case
I'd like to be able to create/update a secret parameter's value.
Solution/User Experience
const ssmClient = new SSMClient({ region: "us-west-2" })
const putTokenCommand = new PutParameterCommand({ Name: secretName, Type: "SecureString", DataType: "text", Value: JSON.stringify(secret), Overwrite: true, });
Alternative solutions
AWS SSM SDK
Acknowledgment
- [X] This feature request meets Powertools for AWS Lambda (TypeScript) Tenets
- [X] Should this be considered in other Powertools for AWS Lambda languages? i.e. Python, Java, and .NET
Future readers
Please react with 👍 and your use case to help us understand customer demand.
Hi @revmischa, thank you for opening this feature request.
I don't see any issue with adding this feature, especially considering that Powertools for AWS Lambda (Python) already has it as well.
In terms of DX, I think we should aim at something like this:
import { setParameter } from '@aws-lambda-powertools/parameters/ssm';
export const handler = async (): Promise<void> => {
const parameterVersion = await setParameter('/my/parameter', {
value: 'foo'
});
};
The signature of the setParameter() function would look like this:
type ParameterType = 'String' | 'StringList' | 'SecureString';
type ParameterTier = 'Standard' | 'Advanced' | 'Intelligent-Tiering';
type SSMSetOptions = {
/**
* The parameter value
*/
value: string;
/**
* If the parameter value should be overwritten
* @default false
*/
overwrite?: boolean;
/**
* The description of the parameter
*/
description?: string;
/**
* Type of the parameter, can be one of `String`, `StringList`, or `SecureString`
* @default `String`
*/
parameterType?: ParameterType;
/**
* The parameter tier to use, can be one of `Standard`, `Advanced`, and `Intelligent-Tiering`
* @default `Standard`
*/
tier?: ParameterTier;
/**
* The KMS key id to use to encrypt the parameter
*/
kmsKeyId?: string;
/**
* Additional options to pass to the AWS SDK v3 client
*/
sdkOptions?: PutParameterCommandInput;
}
declare function setParameter(name: string, options: SSMSetOptions): string;
When it comes to implementation, the work needed to add this feature will need to touch several areas in the codebase, below an initial list (some might be missing):
- Add a new
setParameter()method to theSSMParameterclass (here) - this method should get the inputs and call the AWS SDK method to put the parameter - Add types for the new method here
- Add a new
setParameter()function in a dedicated file similar to this - Export the new function in this barrel file
- Add unit tests for the new feature
- Add end-to-end test case for the new feature
- Update docs similar to this
I'm putting the item on the backlog and opening it for contributions.
[!note] For those interested in contributing, please leave a comment below so that we can assign the issue to you and make sure we don't duplicate efforts. Also, if you have any further questions please don't hesitate to ask here or on our Discord channel. /
@dreamorosi I would like to take this issue :)
Hey @daschaa - sounds great!
Let me know if you have any question about the feature.
Here also is the Python implementation as reference. The implementation and structure on our side is very close to the one in that repo.
Hi @daschaa - hope you are doing well.
I wanted to check in with you to see if you needed any kind of support from our side or if you were still working on this.
If not, no issue at all, we understand life happens 😄
@dreamorosi Hey Andrea, unfortunately due to private reasons I was not able to work on OSS. I forgot to put in a comment, sorry about that!
⚠️ COMMENT VISIBILITY WARNING ⚠️
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
This is now released under v2.8.0 version!