Skip to main content

Lambda Function

Add a Lambda Function resource to your Altostra project

The Lambda Function resource creates a Lambda function.
To add a Lambda Function resource in the designer, go to "Compute" and select the "Lambda Function" resource, or search "lambda" in the search box:

Lambda Resource

Code Tab

Code Tab

Display Name:

type: string | required

  • Altostra will use the name for generating a logical ID:
    • Only strict alpha-numeric characters will be used (by the restrictions of CFN)
    • If no alpha-numeric characters were used in the name, the logical ID will be generated by the resource type.
  • Up to 64 characters
  • Entry Point:
    • The path of the method within your code that Lambda calls to execute your function.
    • Required
    • String

Runtime:

type: string | default: NodeJS 12 | required

  • The runtime provides a language-specific environment that runs in an execution environment. Lambda supports multiple languages through the use of runtimes.
  • Select the identifier of your function's runtime.
  • Required
  • Allowed values:
    • NodeJS 10/12/14/16
    • Python 3.6/3.7/3.8/3.9
    • Go
    • .Net 6
    • .Net Core 3.1
    • Java 8/8 (Amazon Linux 2)/11
    • Ruby 2.7

Settings:

Settings

Memory:

type: integer | default: 512 | required

  • Choose the required amount of memory (MB) that will be available to the function at runtime.
  • The value can be any multiple of 64 (CFN – multiple of 1 MB)
  • Minimum value: 128
  • Maximum value: 3008 (why not 10240? – CFN)

Timeout:

type: integer | default: 3 | allowed values: 1-900 | required

  • Choose the amount of time (seconds) that you want to allow the function to run before stopping it.

Reserved Concurrency:

type: integer | allowed values: 1-10,000 | optional

  • Guarantees the maximum number of concurrent instances for the function.
  • Choose the number of simultaneous executions you want to reserve for the function.
  • You can set this field as a parameter.

Provisioned concurrency:

type: integer | allowed values: 1-10,000 | optional

  • Initializes a requested number of execution environments so that they are prepared to respond immediately to your function's invocations.
  • Choose a number of execution environments to initialize.
  • You can set this field as a parameter.

Environment Variables:

type: Name – Value pairs | optional

Environment Variables
  • Add the environment variables that the lambda needs to access in the execution code.
  • You can set the value as a parameter.

Advanced:

Advanced
  • VPC Config:

    optional

    • By default, Lambda runs your functions in a secure VPC with access to AWS services and the internet. Lambda owns this VPC, which isn't connected to your account's default VPC. When you connect a function to a VPC in your account, the function can't access the internet unless your VPC provides access.

    • If you want to connect a function to a VPC in your account, you need to configure Security Groups IDs and Subnets IDs:

      • Security Group IDs:

        type: strings

        • You can add multiple IDs, separated by commas.
        • Each ID must begin with “sg-”, and must exist in your AWS account.
        • You can set this field as a parameter.
      • Subnet IDs:

        type: strings

        • You can add multiple IDs, separated by commas.
        • Each ID must begin with “subnet-”, and must exist in your AWS account.
        • You can set this field as a parameter.

Inline Policies:

type: JSON | optional

Inline Policies
  • You can add inline policies to your Lambda.

  • Must be a valid policy JSON:

    //example
    {
    "Version": "2012-10-17",
    "Statement": [
    {
    "Effect": "Allow",
    "Action": [
    "s3:ListBucket",
    "s3:ListBucketVersions",
    ],
    "Resource": [
    "arn:aws:s3:::*/*"
    ]
    }
    ]
    }
    • You can set the policy as a parameter.

Connect to IAM Policies:

optional

  • If you added IAM Policy resources, you will be able to select them in this section, so the lambda will be connected to these policies.
IAM Policies

Layers:

optional

Layers
  • A Lambda layer is a .zip file archive that can contain additional code or other content. A layer can contain libraries, a custom runtime, data, or configuration files.

  • You can add a list of function layers to add to the function's execution environment.

  • You can add up to 5 layers to a lambda.

  • Layer ARN:

    type: string

    • Specify each layer by its ARN, including the version.

Image Tab

Image Tab
  • Select this tab to use your own Docker image for your lambda.
  • Instead of providing the code, you need to provide the image ARN.
  • Image requirements:
    • Lambda only supports Linux-based images.
    • Your image extends an AWS base image, or
    • Your image must implement the Lambda Runtime API.
    • The default Lambda user must be able to read all the files required to run your function code.
  • For more information go to: Altostra Lambda Docker Images.

Display Name:

type: string | required

Image URI:

type: string | required

  • Must be a valid ARN.

  • You can set this field as a parameter.

  • Image Properties:

    • Use these properties if you want to configure values that will override the container image Dockerfile settings:

      • Entry Point:

        type: List of strings

        • Choose the entry point to the application.
      • Commands:

        type: List of strings

        • Add the parameters that you want to pass in with ENTRYPOINT.
      • Working Directory:

        type: string

        • Choose the working directory.
  • The rest of the Image tab properties are the same as in the Code tab

Lambda Connections:

Lambda can connect to the following resources:

Connections
  • Existing resources (resources that you added directly in your AWS account):
    • Auth0 Application
    • DynamoDB Table
    • EventBridge Bus
    • KMS
    • S3 Bucket
    • SNS Topic
    • SQS Queue
  • Compute:
    • Fargate Serverless Container:
      • You can use a Lambda function to trigger your Fargate task.
    • Web Service
  • Application Integration:
    • SNS Topic
    • SQS FIFO Queue
    • SQS Queue
  • Database:
  • Storage:
    • S3 Bucket
    • S3 Service
  • Management & Governance:
    • Parameter Store (SSM)
  • Analytics:
    • Kinesis Stream
  • Machine Learning:
    • Recognition Service
  • Business Application:
    • Simple Email Service

Ready to Get Started?

Get Started for Free
© 2022 Altostra, Inc.