AWS Code deploy

Code Deploy Merit
– Automatic deployment
– Minimize Downtime
– Unified management
– Easy to introduce

umm, somehow I do not understand well.

What is code deploy
It is a service that allows you to simultaneously deploy programs to multiple instances tagged by CodeDeploy for programs created by users.

Features
– For multiple deployment objects, deployment speed can be adjusted one at a time, all at once, only half, etc.
– The deployment destination EC2 is automatically determined by an arbitrary tag
– Simply run aws-cli with the local deployment directory specified, zip it and push it to S3
– Just after post-deployment(permission change, Apache’s graceful etc) write in yml and put it in the directory to be deployed.

aws codedeployのログを見る

$ rpm -qa |grep -i codedeploy-agent
codedeploy-agent-1.0-1.1518.noarch

/var/log/aws/codedeploy-agent/*

2018-09-24 10:54:17 INFO [codedeploy-agent(13919)]: Version file found in /opt/codedeploy-agent/.version with agent version OFFICIAL_1.0-1.1518_rpm.
2018-09-24 10:54:17 ERROR [codedeploy-agent(13919)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Missing credentials – please check if this instance was started with an IAM instance profile

これか?
Missing credentials

sudo service codedeploy-agent restart

githubからec2へデプロイ

デプロイとは、ソフトウェアの分野で、開発したソフトウェアを利用できるように実際の運用環境に展開すること。

IAMからロールへ行く
CodeDeployを選択する

ec2 インスタンス
# CodeDeployエージェント
wget https://aws-codedeploy-ap-northeast-1.s3.amazonaws.com/latest/install
chmod +x ./install
sudo ./install auto

# 実行
sudo service codedeploy-agent start

appspec.ymlを編集して、githubにpush

version: 0.0
os: linux
files:
  - source: /
    destination: /home/ec2-user/dev/

code deployからアプリケーションの作成
deployする

deploy長いな。。