Source Control and deployment for AWS Lambda

后端 未结 3 1015
傲寒
傲寒 2021-02-02 10:29

Has anybody come up with a good solution to source control and deploy code to AWS Lambda? I really hate that I have to zip the files all the time and upload them. Is there a bet

3条回答
  •  时光说笑
    2021-02-02 11:05

    #!/bin/bash
    cd /your/workspace
    
    #zips up the new code
    zip -FSr yourzipfile.zip . -x *.git* *bin/\* *.zip
    
    #Updates function code of lambda and pushes new zip file to s3bucket for cloudformation lambda:codeuri source
    aws lambda update-function-code --function-name  arn:aws:lambda:us-west-2:YOURID:function:YOURFUNCTIONNAME --zip-file fileb://yourzipfile.zip
    aws s3 cp yourzipfile.zip s3://yourbucketname/yourzipfile.zip
    

    Depends on aws-cli install and aws profile setup

    aws --profile yourProfileName configure
    

    And my rant: I wish cloudformation lambda:codeuri would accept any url not just s3://bucketname/filename... so I could point it straight to github.

提交回复
热议问题