Git pushでEC2にCodeDeploy

Git pushするとCodeDeployでEC2にDeployされる方法

## IAMユーザの作成
Add user: GitHub
Access type: Programmatic access
Policty: AWSCodeDeployFullAccess
Permission: CreatePolicy

Policy Name: CodeDeploy-Access

Json

{
    "Version": "2020-03-07",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "codedeploy:GetDeploymentConfig",
            "Resource": "arn:aws:codedeploy:ap-northeast-1:${account id}:deploymentconfig:*"
        },
        {
            "Effect": "Allow",
            "Action": "codedeploy:RegisterApplicationRevision",
            "Resource": "arn:aws:codedeploy:ap-northeast-1:${account id}:application:${application name}"
        },
        {
            "Effect": "Allow",
            "Action": "codedeploy:GetApplicationRevision",
            "Resource": "arn:aws:codedeploy:ap-northeast-1:${account id}:application:${application name}"
        },
        {
            "Effect": "Allow",
            "Action": "codedeploy:CreateDeployment",
            "Resource": "arn:aws:codedeploy:ap-northeast-1:${account id}:deploymentgroup:${application name}/${deploy_group}"
        },
        ]
}

### GithubでCodeDeploy用のサービスを追加
– Deploy対象のレポジトリに移動
-> Settings->Integration & Services

Note: GitHub Services have been deprecated. Please contact your integrator for more information on how to migrate or replace a service with webhooks or GitHub Apps.

Servicesは終了しているので、現在はできないようです。