Vagrant box置き場のgithubがAmazonS3に移行したらしい。
とあるboxを追加しようとしたとき。
環境
$ VBoxManage -v
4.3.30r101610
$ vagrant -v
Vagrant 1.7.2
母艦は、MacのYosemite。もう古いなw
コマンド
$ vagrant box add centos7.1 https://github.com/CommanderK5/packer-centos-template/releases/download/0.7.1/vagrant-centos-7.1.box
と、打ち込むと。。。。
Unable to find AWS credentials.
Ensure the following variables are set in your environment, or set
them at the top of your Vagrantfile:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
Alternatively, you can create a credential profile and set the
AWS_PROFILE
environment variable. Consult the documentation for details.
と、エラーが出る。
ちょっと前まで、AWSの設定無しでダウンロード出来たじゃん。
$ curl --head https://github.com/CommanderK5/packer-centos-template/releases/download/0.7.1/vagrant-centos-7.1.box
で、調べる。
Status: 302 Found
Cache-Control: no-cache
Vary: X-PJAX
Location: https://github-cloud.s3.amazonaws.com/releases/44744215/c9808a28-8177-11e5-8c5f-47930a417990.box?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAISTNZFOVBIJMK3TQ%2F20161117%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20161117T085657Z&X-Amz-Expires=300&X-Amz-Signature=0ac1d5e82ea890a99061151abb28113c80c0aafb43bc208bcfb9c4f696be28f8&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dvagrant-centos-7.1.box&response-content-type=application%2Foctet-stream
!!!!!!!!!!
「Location: https://github-cloud.s3.amazonaws.com/」に引っ越してる!!
あー、AWSのアカウントが無いとbox落とせない。。。。
まあ、AWSのアカウントを取って、IAMで「AWS_ACCESS_KEY_ID」と「AWS_SECRET_ACCESS_KEY」と取得して、「~/.aws/credentials」に
「AWS_ACCESS_KEY_ID」と「AWS_SECRET_ACCESS_KEY」を書く
[default]
aws_access_key_id = XXXXXXXXXXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
てな感じで書いて、IAMのコンソールで、
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt99999999999999",
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation"
],
"Resource": [
"arn:aws:s3:::github-cloud"
]
}
]
}
な、ポリシー追加して、ポリシーの検証で「allowed」になったのを確認して、適用したのに、
前記のコマンドを打つと
Request for box's Amazon S3 region was denied.
This usually indicates that your user account is misconfigured. Ensure
your IAM policy allows the "s3:GetBucketLocation" action for your bucket:
arn:aws:s3:::github-cloud
と、アクセスさせてくれない。
もう、いい、githubからboxファイルはもうDLしないよ!(怒)
AWSのS3にアクセスできなくても、大丈夫。俺たちにはHash Corpさんがいる!
こまかいことはここを参照↓
https://www.vagrantup.com/docs/getting-started/boxes.html
簡単にCentOS7のボックスが出来たんですよ。
vagrant box add centos/7
余談だが、CentOS6が欲しければ
vagrant box add centos/6
ありがとう、Hash Corpさん。
Thanks, "Hash Corp."
boxさえ追加出来れば、あとは従来通りセットアップをするだけ。
こんなことに半日費やすとは、いろいろな方々にごめんなさい。
AWSのS3が悪いんですよ、ちゃんと設定しているはずなのに、DLさせてくれないなんて。。。
AWSのアカウントを要求されるのも、なんだかなぁ、、、、って感じです。
AWSのS3経由でDL出来た方、コメント下さい。