1 IAMでCodeCommitの権限を全て持っているユーザーを作成
・ユーザー名はaws_cli_user
・リージョンはus-east-1
で作成
2 Access Key、Secret Access Keyを保存
3 CodeCommit でリポジトリを作成
4 自分のパソコンに(ローカルに)Gitを入れていること
ターミナル
# ローカルにaws cliを入れる
katoatsushi$ pip install awscli --upgrade --user
# 設定
katoatsushi$ aws configure --profile CodeCommitUser
AWS Access Key ID [None]: ASDFGHJKIUYTRFGHJKUYTGFGH
AWS Secret Access Key [None]: sdfgtyujkj/+tgh/mjyRestdH&^FGHJ
Default region name [None]: us-east-1
Default output format [None]: json
katoatsushi$ git config --global credential.helper '!aws --region us-east-1 --profile aws_cli_user codecommit credential-helper $@'
katoatsushi$ git config --global credential.UseHttpPath true
次にgit clone でローカルに落とす
そしてpush
ターミナル
katoatsushi$ git clone https://git-codecommit.us-east-1.amazonaws.com/v1/repos/go-sample-master
Cloning into 'go-sample-master'...
warning: You appear to have cloned an empty repository.
katoatsushi$ cd ~/sample-repo && touch main.go
katoatsushi$ git add .
katoatsushi$ git commit -m"first commit"
katoatsushi$ git push origin master
上手くpush できてました。
次はCodeDeploy、CodePipeline、CodeCommitを使った自動デプロイです