Venus713
Venus713

Reputation: 1591

how to deploy a lambda function using boto3?

I used a following way in nodejs to deploy a lambda function before.

    await aws.command(
      `cloudformation package \
        --template-file ${template} \
        --output-template-file ${serverless} \
        --s3-bucket ${bucketName}`
    ).then(function (data) {
      console.log('cloudformation packaging data=', data)
    })
    console.log('server deploying...')
    await aws.command(
      `cloudformation deploy \
        --template-file ${serverless} \
        --stack-name ${stackName} \
        --capabilities CAPABILITY_IAM`
    ).then(function (data) {
      console.log('cloudformation deploying data=', data)
    })

Here are my cloudformation template file.

AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Resources:
  ExportServer:
    Type: AWS::Serverless::Function
    Properties:
      Handler: src/server.handler
      Runtime: nodejs12.x
      Events:
        AnyRequest:
          Type: Api
          Properties:
            Path: /graphql
            Method: ANY

But now I need to do it using boto3 in python.

Please give me any suggestion.

Upvotes: 0

Views: 1234

Answers (1)

Related Questions