AWS CLIでiam-instance-profileを指定するとUnknown options


 

AWS CLIでEC2インスタンスを起動する際、紐付けするIAMロールをオプションで指定したい。

 
CLIのドキュメントでは、IAM Instance Profileの指定方法は

--iam-instance-profile Arn=value,Name=value

とある。
しかし、実際に指定するとNameの方がUnknown optionsとなってコマンドが失敗する。

 
Unknownと言われてしまったら仕方がないので、arn(IAMの画面の”Instance Profile ARN(s)”)だけ指定したら通った。

aws ec2 run-instances --cli-input-json file://hogehoge.json --iam-instance-profile Arn=arn:aws:iam::0000000000:instance-profile/UpdateS3

 
AWS CLIのドキュメント、ちょくちょく罠が仕掛けられている。日々是修行也。

関連記事