amplify-backend icon indicating copy to clipboard operation
amplify-backend copied to clipboard

Define Resource Tags for AWS Resources

Open fullstackcreatives opened this issue 1 year ago • 5 comments

Environment information

System:
  OS: macOS 14.4.1
  CPU: (8) x64 Apple M1
  Memory: 74.03 MB / 16.00 GB
  Shell: /bin/zsh
Binaries:
  Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
  Yarn: 1.22.4 - /usr/local/bin/yarn
  npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
  pnpm: undefined - undefined
NPM Packages:
  @aws-amplify/backend: 1.0.2
  @aws-amplify/backend-cli: 1.0.3
  aws-amplify: 6.3.2
  aws-cdk: 2.142.0
  aws-cdk-lib: 2.142.0
  typescript: 5.4.5

Description

In Amplify Gen1 it was possible to define tags for AWS resources by adding a tags.json to the project. It seems that this does not work in Gen2. Would be great to have a feature like this in Gen2 also.

fullstackcreatives avatar May 17 '24 07:05 fullstackcreatives

Hey @fullstackcreatives :wave: thanks for raising this! While it's possible to apply tags to individual resource stacks using CDK, we currently do not support applying tags to all resources within the root stack. Marking as a feature request

josefaidt avatar May 17 '24 15:05 josefaidt

Is there any update about this issue?

Sanuki-073 avatar Aug 05 '24 01:08 Sanuki-073

Would love any updates to this and curious when this might get prioritized. Any updates?

OOCAZ avatar Oct 08 '24 17:10 OOCAZ

This is required functionality for working with Amplify in an enterprise environment. Any updates on this feature, or a workaround for accessing the Amplify root stack scope?

Using CDK scoping, tagging can be applied to the data backend resources, however that's not exposed for the auth backend, nor the root Amplify stack.

viaferreirj avatar Oct 10 '24 13:10 viaferreirj

For anyone watching this request, I was able to tag all the resources with the following hack:

backend.data.node.scopes.forEach((scope) => {
    for (const [key, value] of Object.entries(tags)) {
        Tags.of(scope).add(key, value);
    }
})

Where tags is a key-value map.

viaferreirj avatar Oct 10 '24 14:10 viaferreirj