-
Notifications
You must be signed in to change notification settings - Fork 4k
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
aws-cdk-lib/aws-kms: No available option to get the a Alias ARN #28105
Comments
Looks like the only return attribute is the alias name: Yes it would be great to return the ARN from L2 construct. |
Isn't the aws-cdk/packages/aws-cdk-lib/aws-kms/lib/alias.ts Lines 62 to 68 in b865320
|
Thanks for the quick feedback @daschaa. I noticed that using I noticed too that this const key = new Key(this, "app_key") // My KMS Key
const alias = new Alias(this, "app_key_alias", { targetKey: key })
key.keyArn // My Key ARN
alias.keyArn // My Alias ARN
alias.aliasTargetKey.keyArn // My Key ARN
Is there a reason behind this naming variation? |
I agree, this is indeed very confusing for users. And I don't think there is a purpose behind the naming. How could we improve this here? Renaming the attribute is not possible, because we have to be backwards compatible. Do you think it would be sufficient to change the documentation? |
May creating a new Other than that updating the docs would for sure help too, was looking into it and I think this one may be straight up wrong about this: class Alias (construct). Let me know what you think about those points and if I can help further. |
…lias (#28197) **Motivation:** The current implementation of `keyArn` within the AWS CDK AWS KMS module returns the Key ARN for a key and an alias, which causes confusion for users expecting the Alias ARN. This PR aims to alleviate this confusion by providing clearer access to the Alias ARN. **Changes:** Introducing a new attribute `aliasArn` that mirrors the value from `keyArn` specifically for aliases to explicitly retrieve the Alias ARN. ```typescript /** * The ARN of the alias. * * @Attribute * @deprecated use `aliasArn` instead */ public get keyArn(): string { return Stack.of(this).formatArn({ service: 'kms', // aliasName already contains the '/' resource: this.aliasName, }); } /** * The ARN of the alias. * * @Attribute */ public get aliasArn(): string { return this.keyArn; } ``` **Query:** Should we deprecate the existing `keyArn` and mirror it in `aliasArn` or change the logic within `keyArn` to `aliasArn` and use the `keyArn` as the mirror? > Your feedback on the preferred approach would be greatly appreciated! Closes #28105. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
…lias (aws#28197) **Motivation:** The current implementation of `keyArn` within the AWS CDK AWS KMS module returns the Key ARN for a key and an alias, which causes confusion for users expecting the Alias ARN. This PR aims to alleviate this confusion by providing clearer access to the Alias ARN. **Changes:** Introducing a new attribute `aliasArn` that mirrors the value from `keyArn` specifically for aliases to explicitly retrieve the Alias ARN. ```typescript /** * The ARN of the alias. * * @Attribute * @deprecated use `aliasArn` instead */ public get keyArn(): string { return Stack.of(this).formatArn({ service: 'kms', // aliasName already contains the '/' resource: this.aliasName, }); } /** * The ARN of the alias. * * @Attribute */ public get aliasArn(): string { return this.keyArn; } ``` **Query:** Should we deprecate the existing `keyArn` and mirror it in `aliasArn` or change the logic within `keyArn` to `aliasArn` and use the `keyArn` as the mirror? > Your feedback on the preferred approach would be greatly appreciated! Closes aws#28105. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Describe the bug
Currently, there is no available option to retrieve an Alias ARN within the AWS KMS module of the AWS CDK.
Expected Behavior
I expected to find a method or property within the AWS KMS construct that allows retrieving the Alias ARN associated with a specific key.
Current Behavior
There isn't a direct method or property available to retrieve the Alias ARN associated with a KMS key in the AWS CDK AWS KMS module.
Reproduction Steps
Possible Solution
One potential fix for this issue could be to introduce a method or property within the KMS module that exposes the Alias ARN associated with a key. Like there is for the
kms.Key
Additional Information/Context
Understanding the Alias ARN is crucial for various operational and management tasks involving KMS keys. Having a direct way to retrieve this information within the CDK AWS KMS module would streamline many use cases.
CDK CLI Version
2.110.0 (build c6471f2)
Framework Version
No response
Node.js Version
v20.9.0
OS
Ubuntu 22.04.3 LTS
Language
TypeScript
Language Version
Typescript (3.9.10)
Other information
The text was updated successfully, but these errors were encountered: