使用redshift boto时出错

时间:2017-03-28 01:16:43

标签: python amazon-web-services amazon-redshift boto boto3

import boto3

client = boto3.Session(profile_name='Sandbox').client('redshift')
response = client.create_tags(ResourceName='arn:aws:redshift:us-east-1:123456:snapshot:situation',
Tags=[ {'Key': 'k1', 'Value': 'v1'},{'Key': 'k2', 'Value': 'v2'}])

打印回复

错误:

File "sai.py", line 5, in <module>
    response = client.create_tags(ResourceName='arn:aws:redshift:us-east-1:123456:snapshot:situation',Tags=[ {'Key': 'k1', 'Value': 'v1'},{'Key': 'k2', 'Value': 'v2'}])
  File "/Library/Python/2.7/site-packages/botocore/client.py", line 253, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Library/Python/2.7/site-packages/botocore/client.py", line 543, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidParameterValue) when calling the CreateTags operation: The format of the provided snapshot identifier is invalid.

1 个答案:

答案 0 :(得分:0)

它是appears that Amazon Redshift快照的ARN格式:

arn:aws:redshift:[region]:[account]:snapshot:[cluster-name]/[snapshot-name]

因此,请尝试使用:

arn:aws:redshift:us-east-1:123456:snapshot:*/situation