aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.81k stars 821 forks source link

Adding tags to specific resources (namely DynamoDB) #6762

Open gruckion opened 3 years ago

gruckion commented 3 years ago

Note: If your question is regarding the AWS Amplify Console service, please log it in the official AWS Amplify Console forum

Which Category is your question related to?

API

Amplify CLI Version

You can use amplify -v to check the amplify cli version on your system

4.44.2

What AWS Services are you utilising?

AWS AppSync, DynamoDB

Provide additional details e.g. code snippets

I am aware that we can tag resources created by Amplify using the tags file here. But I would like to add tags only to specific resources, namely DynamoDB.

Our use case is that we have automatic backups setup if we tag our resource with backup : daily. The issue here is that the DynamoDB resource does not go into version control so adding the tag to the CloudFormation resource directly wouldn't be suitable.

How can I add the tag backup : daily when using the API category with a GraphQL API that makes use of the @model directive?

edwardfoyle commented 3 years ago

Hi @gruckion the tagging mechanism in the CLI does not currently support per-resource tags. If you want to apply that tag to all tables in the project, you could add it as a tag to the whole project, it just wouldn't have any meaning on resources besides DynamoDB tables. I realize that's not an ideal solution, but could be workable.

gruckion commented 3 years ago

@edwardfoyle Hi, cheers for getting back to me. This is the solution I have gone with. It would be nice to be able to do this in future. Can the team consider this as a feature request?

Are there any other ways in which this can be achieved? This managed CloudFormation abstraction is a positive for lowering the barrier to entry for AWS. But for long term to get this control it sounds like the only way to do it is to drop the Amplify CLI and go with other solutions (Terraform, Serverless, or just CloudFormation).