Berry Blue
Berry Blue

Reputation: 16482

Save and test AWS Lambda Functions

Is there a way to save & test an AWS Lambda function with a single click? Ideally, I'd like to be able to test unsaved changes but I don't see an option for this. I'm just finding it tedious to save each time I want to test out changes.

Upvotes: 1

Views: 1785

Answers (2)

John Rotenstein
John Rotenstein

Reputation: 269480

If you are creating your Lambda function via the AWS Lambda console, then you will need to Save the function before running Test. This is because the function runs on a Lambda container, not in the console.

Alternatively, you can run Lambda Local to test functions on your own computer rather than on the Lambda service. Once the code works, you can upload it to AWS.

See: Run AWS Lambda Functions Locally on a Windows Machine - DZone Cloud

Upvotes: 2

Adrian
Adrian

Reputation: 2113

How about using Endly automation runner with aws/lambda service

In this case, you would define your deployment workflow and just run it with

endly deploy

Where deploy.yaml defines automation workflow

init:
  functionRole: lambda-helloworld-executor
  functionName: HelloWorld
  codeZip: /tmp/hello/main.zip
  privilegePolicy: privilege-policy.json
pipeline:
  deploy:
    action: aws/lambda:deploy
    credentials: aws
    functionname: $functionName
    runtime:  go1.x
    handler: helloworld
    code:
      zipfile: $LoadBinary(${codeZip})
    rolename: lambda-helloworld-executor
    define:
      - policyname: my-bucket-role
        policydocument: $Cat('${privilegePolicy}')
    attach:
      - policyarn: arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole

Finally, you might be in end to end testing automation here

Upvotes: 0

Related Questions