2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CodeBuildを使ったlambda自動更新のメモ

Posted at

artifactがよくわからない。。。

codebuildを使ったlambdaの更新を調べると、
artifactを使って...があったのですがartifactがよくわからない。。。
なので使わないメモ
※やり方があっているかは不明です。。。

リポジトリ構造

tree.sh
$ tree ./
./
├── README.md
├── buildspec.yml
├── lambda_function.py
└── requirements.txt

やり方

  1. codebuildで使うroleに適当なS3とlambdaの権限を与える
  2. 以下のbuildspec.ymlを使ってビルドする
buildspec.yml
version: 0.1

phases:
  install:
    commands:
      - pip install -t . -r requirements.txt
  build:
    commands:
      - zip -r {{FUNCTION_NAME}}.zip ./
      - aws s3 cp {{FUNCTION_NAME}}.zip s3://{{LAMBDA_BUCKET}}/
      - aws lambda update-function-code --function-name {{FUNCTION_NAME}} --s3-bucket {{LAMBDA_BUCKET}} --s3-key {{FUNCTION_NAME}}.zip
# artifacts:
#   type: zip
#   files:
#     - "**/*"
#   discard-paths: no
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?