デプロイしたらエラーがでた。
One or more objects in the Elastic Beanstalk bucket could not be deleted. Verify that your S3 policies allow you to perform 's3:DeleteObject'.
Elastic Beanstalkが作ったS3バケットは削除できないようポリシーがデフォルトで設定されている。何のにこいつは削除をするから権限よこせといいやがる。zip形式でデプロイしてるせいかもしれないけれど、しょうがないので許可設定をする。
S3にelasticbeanstalk-ap-northeast-1-xxxxxxxxxxxxみたいなバケット名が作られているので、Properties選択後、Permissions、Edit bucket policyから下記の部分を探す。
{
"Sid": "hogehoge",
"Effect": "Deny",
"Principal": {
"AWS": "*"
},
"Action": "s3:DeleteBucket",
"Resource": "arn:aws:s3:::elasticbeanstalk-ap-northeast-1-xxxxxxxxxxxx"
}
Allowに書き換え
"Effect": "Allow",
これで、Elastic Beanstalkの画面でデプロイ済みのバージョンに切り替えできました。…ポリシー編集しなくても切り替えだけでできたんじゃないかと思ったりなんたり。