Skip to content

Feature request: Put parameter #2871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
revmischa opened this issue Aug 1, 2024 · 7 comments · Fixed by #3020
Closed
2 tasks done

Feature request: Put parameter #2871

revmischa opened this issue Aug 1, 2024 · 7 comments · Fixed by #3020
Assignees
Labels
completed This item is complete and has been merged/shipped feature-request This item refers to a feature request for an existing or new utility parameters This item relates to the Parameters Utility

Comments

@revmischa
Copy link

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

Future readers

Please react with 👍 and your use case to help us understand customer demand.

@revmischa revmischa added feature-request This item refers to a feature request for an existing or new utility triage This item has not been triaged by a maintainer, please wait labels Aug 1, 2024
@dreamorosi
Copy link
Contributor

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 the SSMParameter class (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 dreamorosi moved this from Triage to Backlog in Powertools for AWS Lambda (TypeScript) Aug 5, 2024
@dreamorosi dreamorosi added parameters This item relates to the Parameters Utility confirmed The scope is clear, ready for implementation help-wanted We would really appreciate some support from community for this one and removed triage This item has not been triaged by a maintainer, please wait labels Aug 5, 2024
@daschaa
Copy link
Contributor

daschaa commented Aug 5, 2024

@dreamorosi I would like to take this issue :)

@dreamorosi
Copy link
Contributor

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.

@dreamorosi dreamorosi moved this from Backlog to Working on it in Powertools for AWS Lambda (TypeScript) Aug 5, 2024
@dreamorosi
Copy link
Contributor

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 😄

@daschaa
Copy link
Contributor

daschaa commented Sep 1, 2024

@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!

Copy link
Contributor

⚠️ 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.

@github-actions github-actions bot added pending-release This item has been merged and will be released soon and removed help-wanted We would really appreciate some support from community for this one confirmed The scope is clear, ready for implementation labels Sep 11, 2024
Copy link
Contributor

This is now released under v2.8.0 version!

@github-actions github-actions bot added completed This item is complete and has been merged/shipped and removed pending-release This item has been merged and will be released soon labels Sep 16, 2024
@dreamorosi dreamorosi moved this from Coming soon to Shipped in Powertools for AWS Lambda (TypeScript) Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed This item is complete and has been merged/shipped feature-request This item refers to a feature request for an existing or new utility parameters This item relates to the Parameters Utility
Projects
3 participants