我正在尝试使用 Boto3 和 Python 获取 ElastiCache 标签。在 boto3 中有一个名为 list_tags_for_resource() 的函数。但是,我面临的问题是,如何找到资源名称。我正在使用以下代码:
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)
这给出了以下错误:
botocore.exceptions.ClientError: An error occurred (InvalidParameterValue) when calling the ListTagsForResource operation: Unauthorized call. Please check the region or customer id