I am trying to fetch ElastiCache Tags using Boto3 and Python. In boto3, there is a function called- list_tags_for_resource(). But, the problem I am facing is, how to find the resource name. I am using the following code:
from boto3.session import Session
sess = Session(aws_access_key_id=id,aws_secret_access_key=key)
conn = sess.client(service_name='elasticache', region_name='us-east-1')
arn="arn:aws:elasticache:us-east-1:123456:cluster:name_of_cluster"
print conn.list_tags_for_resource(ResourceName=name)
This is giving the following error :
botocore.exceptions.ClientError: An error occurred (InvalidParameterValue) when calling the ListTagsForResource operation: Unauthorized call. Please check the region or customer id
If you are using the ReadOnlyAccess managed policy, you will not be able to list tags for elasticache. Ensure that your user has
elasticache:ListTagsForResource
explicitly set in their policy. Amazon does not currently include that permission in their ReadOnlyAccess policy. A policy that allows viewing elasticache tags would look like:I believe this should be part of the ReadOnlyAccess policy,and opened a ticket with Amazon. This was their response: