2017-03-28 4 views
0
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'}]) 

réponse ImprimerObtenir une erreur lors de l'utilisation redshift Boto

Erreur:

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. 
+0

Pouvez-vous formater correctement votre question? – kaveh

+0

En outre, la lecture du message d'erreur vous donne des indices. – kaveh

+0

kaven, pouvez-vous s'il vous plaît vérifier le paramètre Tag, il dit que je donne un identifiant invalide? mais dans ce create_tag (ResourceName = '' string '', tags = '' «) alors pourquoi il montre identifiant instantané est invalide? @kaveh –

Répondre

0

Il appears that le format ARN pour un instantané Redshift Amazon est:

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

Par conséquent, , essayez d'utiliser:

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

mais lorsque je tente de générer arn = ARN self.manager.generate_arn (s ['SnapshotIdentifier']) Je reçois arn: aws: redshift: us-east-1: 4712341: instantané: situation –

+0

C'est intéressant - je n'ai jamais vu 'generate_arn()' avant. sur cette commande? Est-ce une partie de boto? –