suzuki-shunsuke / issue

MIT License
4 stars 0 forks source link

Lambda を AWS CodeDeploy でデプロイする #71

Open suzuki-shunsuke opened 2 years ago

suzuki-shunsuke commented 2 years ago

https://docs.aws.amazon.com/ja_jp/codedeploy/latest/userguide/welcome.html

suzuki-shunsuke commented 2 years ago
suzuki-shunsuke commented 2 years ago

AppSpec を使ったデプロイ

version: 0.0
Resources:
  - MyFunction: # Replace "MyFunction" with the name of your Lambda function 
      Type: AWS::Lambda::Function
      Properties:
        Name: "test-suzuki-shunsuke" # Specify the name of your Lambda function
        Alias: "develop" # Specify the alias for your Lambda function
        CurrentVersion: "1" # Specify the current version of your Lambda function
        TargetVersion: "2" # Specify the version of your Lambda function to deploy

指定した alias の version を Blue/Green Deploy する。 予め function, alias, version は存在する必要がある。

新しい version のリリースは CodeDeploy のカバー範囲ではないように見える。

ここまでは CodeBuild などの CI ツールでやる感じなのだろうか?

AppSpec を生成し、 deploy をトリガーする必要がある。

suzuki-shunsuke commented 2 years ago

AWS CodeDeploy CLI

https://awscli.amazonaws.com/v2/documentation/api/latest/reference/deploy/index.html

https://awscli.amazonaws.com/v2/documentation/api/latest/reference/deploy/create-deployment.html

suzuki-shunsuke commented 2 years ago

Enter a service role with CodeDeploy permissions that grants AWS CodeDeploy access to your target instances.

Service Role が必要