By using AWS re:Post, you agree to the Terms of Use

Automatically tag Redshift Snapshots

0

Is there a way to automatically tag the auto snapshots in Redshift? I simply want the tags from the cluster applied to each snapshot when it's created.

asked 24 days ago19 views
1 Answer
0

Hello,

Thank you for reaching out to us with your concern. I understand that you would like to know a way to automatically tag the auto snapshots in Redshift.

Automated snapshots inheriting tags associated with your Redshift cluster.

While creating a Manual Snapshot, it will inherit the tags from the Cluster and tags are retained after you restore a snapshot of a Cluster within the same region (note that tags are not retained if you copy a snapshot to another region), the same does not apply to Automated Snapshots.

When Automated Snapshots are created, tags are not inherited from the Cluster, and therefore are not retained after you restore a snapshot. Additionally, while you can add tags directly to the automated snapshot via console (CLUSTERS -> Snapshots -> Actions -> Manage tags), it will also fail to retain the tags after you restore the snapshot.

That being said, and considering that Automated Snapshots do not inherit nor retain the tags.I have checked internally and confirmed that there is already a Feature Request for Automatic Tagging of Automated RedShift Snapshots.

Kindly note that, due to the managed nature of the service, before a formal introduction, features are required to be tested and pre-configured as per the existing ecosystem. Since we have no visibility over the internal development cycles, because of which I unfortunately would not be able to provide you with an ETA on when this feature would be implemented/released. However I would recommend you to refer to and keep an eye on the following links for announcements regarding latest features in Amazon Redshift, as it would be publicly announced as soon as this feature is introduced:

[1] AWS What's New - http://aws.amazon.com/new/

[2] AWS Blog - https://aws.amazon.com/blogs/?awsf.blog-master-database=category-database%23amazon-redshift

[3] AWS Forums - https://forums.aws.amazon.com/forum.jspa?forumID=155

Currently available options to apply tags to automated snapshots

An alternative way to automate this process at your end would be to make use of CLI/API operations. These CLI/API operations can be used as a part of any automated code/script/function (such as a cron job, a Lambda function, or any other suitable/feasible method to automate the process of creating/applying tags) to apply tags to automated snapshots, without having to perform the same manually via the console. The code/functionality of the automated solution would be to apply/create tags for automated snapshots [4].

For example, the create-tags CLI command can be run to apply tags to an automated snapshot. The create-tags API requires the ResourceName to be provided, whose ARN format is as follows:

arn:aws:redshift:region:account-id:snapshot:cluster-name/snapshot-name

Once you obtain the name of the snapshot, the above ARN can be formed, post which the ARN can be passed to the create-tags command to apply required tags.

I have tested the same at my end and I was able to successfully add a tag to an automated snapshot of my Redshift cluster in the below manner:

#> aws redshift create-tags --resource-name arn:aws:redshift:us-east-1:xxxx:snapshot:xxxx/rs:xxxx --tags "Key"="type","Value"="automated"

Post running the above, a tag "type=automated" was added to the automated snapshot, which can be verified on the console, as well as by using the describe-tags CLI command:

aws redshift describe-tags --resource-name arn:aws:redshift:us-east-1:xxxx:snapshot:xxxx/rs:xxxx

Output:

{

"TaggedResources": [

    {

        "Tag": {

            "Key": "type",

            "Value": "automated"

        },

        "ResourceName": "arn:aws:redshift:us-east-1:xxxx:snapshot:xxxx/rs:xxxx",

        "ResourceType": "snapshot"

    }

]

}

I hope the above information is useful to you.

Thank you and have a nice day ahead!

==== References ====

[4] Tagging resources in Amazon Redshift- https://docs.aws.amazon.com/redshift/latest/mgmt/amazon-redshift-tagging.html

[5] create-tags - https://docs.aws.amazon.com/cli/latest/reference/redshift/create-tags.html

[6] describe-tags - https://docs.aws.amazon.com/cli/latest/reference/redshift/describe-tags.html

[7] Manage tags for Redshift resources using CLI/APIoperations- https://docs.aws.amazon.com/redshift/latest/mgmt/rs-mgmt-tagging-cli-api.html

answered 23 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions