Skip to content

Add support for tagged RDS DBInstances #1061

Closed
wants to merge 9 commits into from
@gertjanol

These commits add support for listing, creating and removing tags to and from RDS-DBInstances (ListTagsForResource, AddTagsToResource and RemoveTagsFromResource API calls).

Amazon requires an ARN to reference the DBInstance on which the actions are performed, but doesn't supply this ARN, afaik. I added a property to the DBInstance-class, which uses IAM (for the account-id) to construct the ARN itself when asked for. It's not very clean, but I didn't see another way. If Amazon does supply the ARN in another way, or in the future, this could easily be removed while retaining backwards compatibility.

I'm hoping to add support for a TaggedRDSResource, similar to the TaggedEC2Resource.

I welcome your thought and suggestions!

PS: this is the same pull-request as #1050, but from it's own branch

[update 2012-11-06]
Implement classmethods for getting, adding and removing tags as methods from boto.rds.DBInstance. This is different than the implementation of EC2 tags. This is due to differences in the API: the EC2 API offers tags for more than just Instances, hence the superclass TaggedEC2Object. It also supplies all tags from a resource in each DescribeResource API call.

RDS only offers tags for DBInstances, and separate API calls are needed to retrieve them.

However, the interface for the user (dbinstance.tags, dbinstance.add_tag(key, value) and dbinstance.remove_tag(key)) is the same as for EC2 tags. If Amazon in the future does provide tags in the same way as EC2 tags, this could easily be refactored (and maybe even use the same superclass).

@sstoiana

Can we get this in?

@garnaat garnaat referenced this pull request Dec 3, 2012
Closed

RDS tagging #1141

@znewman01

👍 would love to see this merged in

@gertjanol

Me too :). But I haven't received feedback from Mitch, so I don't know what it's waiting for.

@J5
J5 commented May 28, 2013

Thanks for this patch. I have it monkey patched into our code. One thing I would like to mention is that you are getting the account_id via an IAM call which we may not have access to since we are doing these calls as a third party on behalf of our clients using restricted IAM roles. Instead we grab the account id through the security groups API:

sg = ec2.get_all_security_groups()
account_id = sg[0].owner_id

@reversefold

I had previously implemented the same functionality and bowed to this one, but I've recently opened another pull request, #1641 which also has unit tests for everything.

@phspagiari

+1 This is already merged?

@gkope
gkope commented Nov 13, 2013

+1

@bilalaslam

+1. This would be nice to have.

@worldofchris

+1. Could really do with being able to see the tags on RDS instances as well as on EC2.

@monkey1016

+1 Could definitely use this feature as well.

@bpollack

Would someone on the Boto team mind telling us what you'd want for this to get merged? It looks like #1641 has unit tests, which wasn't enough to get it merged, either. I'm happy to take a stab at whatever improvements you guys are looking for.

@toastdriven

@bpollack This PR wasn't merged because there aren't any tests on it. The rough consensus is that some combination of this & #1061 + tests would be best, but there hasn't been time to get back there.

We're still discussing what to do about RDS, given that we're lagging significantly behind on the module vs. the API. I'll update here when we have something to share.

@defionscode

+1 for sure

@danielgtaylor
the boto project member

Please note that boto now contains a new rds2 module with the latest Amazon RDS API support. It is a low-level module, but supports all the new features and is significantly easier for us to maintain.

http://boto.readthedocs.org/en/latest/ref/rds2.html
http://boto.readthedocs.org/en/latest/migrations/rds_v1_to_v2.html
https://github.com/boto/boto/tree/develop/boto/rds2

This module will be released soon in boto 2.26.0.

@defionscode

Is there a ETA on 2.26.0?

@wigsy
wigsy commented Feb 26, 2014

+1

@danielgtaylor
the boto project member

Boto-2.26.0 is now out! Closing this PR for the time being - please resubmit with tests if you wish to backport these features to boto.rds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.