capabilities.work

Deploy a Function and Verify It Runs

A 3-step recipe with AWS Lambda. We can help you get access.

Recipe · 3 steps

Deploy a Function and Verify It Runs

with AWS Lambda · IT Infrastructure Management

Create a Lambda function, wait for it to become Active, and test-Invoke it.

  1. Create the Lambda function from the staged S3 deployment package. Publish is left false so the unpublished $LATEST version is what gets tested; a version is only cut once the code is known good.
  2. Poll the function configuration until Lambda finishes provisioning. A newly created function reports State "Pending" first; invoking before it reaches "Active" is rejected, so this step retries until the state settles.
  3. Invoke the function synchronously with the test payload. The Tail log type returns the last 4 KB of the execution log base64-encoded, and the X-Amz-Function-Error response header is present when the handler itself threw, which a 200 status
What you'll need to have ready
  • functionName: The name of the function to create (e.g. order-processor).
  • runtime: The runtime identifier for the function (e.g. nodejs20.x, python3.12).
  • roleArn: The ARN of the IAM execution role Lambda assumes when running the function.
  • handler: The entry point in the code (e.g. index.handler).
  • s3Bucket: The S3 bucket holding the deployment package ZIP.
  • s3Key: The S3 key of the deployment package ZIP.
  • description: An optional human-readable description for the function.
  • memorySize: Memory in MB allocated to the function.
  • timeout: Maximum execution time in seconds before Lambda stops the invocation.
  • environmentVariables: Map of environment variable name/value pairs to expose to the handler.
  • testPayload: The JSON event passed to the function during the verification Invoke.
For your developer

Arazzo workflow aws-lambda:deploy-function, 3 operations: CreateFunction → GetFunctionConfiguration → Invoke. Specs on APIs.io.