Skip to content

Instantly share code, notes, and snippets.

@Alexnder
Last active December 26, 2019 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Alexnder/bf0e756d6ca4bd9a9f961767d2448a90 to your computer and use it in GitHub Desktop.
Save Alexnder/bf0e756d6ca4bd9a9f961767d2448a90 to your computer and use it in GitHub Desktop.
Upload, download code to AWS Lambda

install and configure aws-cli (the actual version is available in Python)

pip3 install awscli
aws configure

add and check another user

aws configure --profile new-name-name
aws --profile new-name-name sts get-caller-identity

Lambda

prepare .zip file with a code

cd my-function-name; zip -r ../my-function-name.zip .; cd ..

upload code as a zip

aws lambda update-function-code --function-name my-function-name --zip-file fileb://my-function-name.zip

download code as a zip

aws lambda get-function --function-name my-function-name --query 'Code.Location' | xargs wget -O my-function-name.zip

Node aws-sdk

Set user configuration inline

const AWS = require('aws-sdk');
AWS.config.update({
  accessKeyId: 'XXX',
  secretAccessKey: 'XXXXXXX',
  region: 'eu-west-1'
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment