Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
350 views
in Technique[技术] by (71.8m points)

amazon web services - How to setup automated deployment from Code Commit to a Lambda Function?

I'm trying to "deploy" the content of a CodeCommit repository to a Lambda function (not an application). In this particular case it's a simple copy/paste from source to destination.

I'm struggling to find a solution that doesn't involve setting up another lambda function. From what I understand, there is a solution using CodeBuild and CloudFormation.

Does anyone have a solution for this ? Alternatively, can you point to any good documentation ?

P.S:

I found this question on StackOverflow that seems to answer my question but the links in the relevant answer are outdated.

question from:https://stackoverflow.com/questions/65851769/how-to-setup-automated-deployment-from-code-commit-to-a-lambda-function

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can build a Code Commit Pipeline with a CodeBuild Job where you CodeCommit repository has a SAM Template like below and you run

sam build && sam deploy

From the codebuild job.


AWSTemplateFormatVersion : '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: A sample SAM template for deploying Lambda functions.

Resources:
# Details about the myDateTimeFunction Lambda function
  myDateTimeFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: myDateTimeFunction.handler
      Runtime: nodejs12.x
# Creates an alias named "live" for the function, and automatically publishes when you update the function.
      AutoPublishAlias: live
      DeploymentPreference:
# Specifies the deployment configuration
          Type: Linear10PercentEvery2Minutes

This documentation page describes the same CodeCommit Rolling deployments for Lambda functions


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...