Windows環境のAWS CLIでec2 create-tagsができない


 

Windows(PowerShell)環境でAWS CLIを使い、EC2インスタンス起動後にタグを付与したい。

バージョンはaws-cli/1.7.7 Python/2.7.9 Windows/7。

普通に、PowerShellのコンソールからcreate-tags実行してるのに、クライアントエラーになる。
なぜタグ付けができんのだ。

PS C:\AWS> aws ec2 create-tags --resources i-xxxxxxxx --tags Key=Name,Value=test

A client error (InternalError) occurred when calling the CreateTags operation: An internal error has occurred

Linux上ではうまくいくのになぜ・・と思いリファレンスを見直すと、

If you are using Windows PowerShell, break out the characters with a backslash (\), surround them with double quotes (“), and then surround the entire key and value structure with single quotes (‘):

Command:

aws ec2 create-tags –resources i-1a2b3c4d –tags ‘Key=\”[Group]\”,Value=test’
create-tags — AWS CLI 1.7.15 documentation

とある。

Windows(PowerShell)の環境では、–tagsの値をシングルクオートで囲む必要があったのであった・・。


PS C:\AWS> aws ec2 create-tags --resources i-xxxxxxxx --tags 'Key=Name,Value=test'

できた。

罠だわ~。

関連記事