CodeDeployでEC2をデプロイできるように、事前の設定作業が必要なので、大まかな流れだけをまとめてみた。
EC2側の設定
- アタッチするIAMロールの設定
(参考: Step 4: Create an IAM instance profile for your Amazon EC2 instances)- ポリシーの作成
- ロールの作成
- タグの設定
- CodeDeployエージェントをインストールする
CodeDeployエージェント
CodeDeploy agentを起動しているか
sudo systemctl status codedeploy-agent
CodeDeployログの確認
sudo tail -f /var/log/aws/codedeploy-agent/codedeploy-agent.log
sudo tail -f /opt/codedeploy-agent/deployment-root/deployment-logs/codedeploy-agent-deployments.log
CodeDeploy側の設定
- アプリケーションの作成
- デプロイグループの作成
EC2に設定したタグでデプロイ対象を指定する