Skip to content

Instantly share code, notes, and snippets.

@daknhh
Created June 10, 2022 08:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daknhh/d27fd1a85b6b5a5d5c39fbc9e62e6446 to your computer and use it in GitHub Desktop.
Save daknhh/d27fd1a85b6b5a5d5c39fbc9e62e6446 to your computer and use it in GitHub Desktop.
Lambda Package Builder for graviton using taskfile.dev
version: '3'
#output: prefixed
env:
LambdaS3Bucket: ambda-code-eu-central-1
Version: 0.0.1
LambdaSourceCodeDirectory: config-rules
vars:
REGION: echo AWS_REGION
tasks:
uploadlambdacode:
desc: Upload Lambda to s3
cmds:
- echo $'\n ⌛️ Uploading Python Lambda {{.LambdaSourceCodeDirectory}} with dependencies'
- echo $'\n📁 Creating Temp Directory'
- mkdir temp
- cp -R {{.LambdaSourceCodeDirectory}}/ temp/
- echo $'\n👩🏼‍🔧 Installing Python Dependencies for graviton to temp directory'
- pip3 install -r temp/requirements.txt --platform manylinux2014_aarch64 --no-deps --target temp
- echo $'\n🤐 Zip temp directory for lambda and upload to s3 Lambda Bucket'
- cd temp && zip -rq {{.LambdaSourceCodeDirectory}}-{{.Version}}.zip .
- cd temp && aws s3 cp {{.LambdaSourceCodeDirectory}}-{{.Version}}.zip s3://{{.LambdaS3Bucket}}/{{.LambdaSourceCodeDirectory}}/{{.LambdaSourceCodeDirectory}}-{{.Version}}.zip
- echo $'\n🧹 Deleting Temp Files'
- rm -r temp
vars:
ACCOUNT:
sh: aws sts get-caller-identity |jq -r .Account
silent: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment