Camel Components

AWS Lambda

Since Camel 3.2

Only producer is supported

The AWS2 Lambda component supports create, get, list, delete, and invoke AWS Lambda functions.

Prerequisites

You must have a valid Amazon Web Services developer account, and be signed up to use Amazon Lambda. More information is available at AWS Lambda.

When creating a Lambda function, you need to specify an IAM role which has at least the AWSLambdaBasicExecuteRole policy attached.

URI Format

aws2-lambda://functionName[?options]

You can append query options to the URI in the following format:

?options=value&option2=value&…​

Configuring Options

Camel components are configured on two separate levels:

  • component level

  • endpoint level

Configuring Component Options

At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.

For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.

Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.

You can configure components using:

  • the Component DSL.

  • in a configuration file (application.properties, *.yaml files, etc).

  • directly in the Java code.

Configuring Endpoint Options

You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.

Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.

A good practice when configuring options is to use Property Placeholders.

Property placeholders provide a few benefits:

  • They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.

  • They allow externalizing the configuration from the code.

  • They help the code to become more flexible and reusable.

The following two sections list all the options, firstly for the component followed by the endpoint.

Component Options

The AWS Lambda component supports the following options which are listed below.

Name Description Default Type

configuration (producer)

The configuration that the endpoints of this component start from. Each endpoint gets a copy of it, and the options of the endpoint replace its values.

Lambda2Configuration

invocationType (producer)

How invokeFunction invokes the function. RequestResponse waits until the function has finished and gives its result. Event queues the event for an asynchronous invocation and answers at once with status code 202 and an empty body. DryRun only checks that the function can be invoked (status code 204). The CamelAwsLambdaInvocationType header overrides it per message. Not used with pojoRequest.

Enum values:

  • RequestResponse

  • Event

  • DryRun

RequestResponse

String

lazyStartProducer (producer)

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

boolean

logType (producer)

Set to Tail to get the last 4 KB of the execution log of a RequestResponse invocation in the CamelAwsLambdaLogResult header (base64-encoded). The CamelAwsLambdaLogType header overrides it per message. Not used with pojoRequest.

Enum values:

  • None

  • Tail

None

String

operation (producer)

The operation that the producer performs. The CamelAwsLambdaOperation header replaces this option.

Enum values:

  • listFunctions

  • getFunction

  • createAlias

  • deleteAlias

  • getAlias

  • listAliases

  • createFunction

  • deleteFunction

  • invokeFunction

  • updateFunction

  • createEventSourceMapping

  • deleteEventSourceMapping

  • listEventSourceMapping

  • listTags

  • tagResource

  • untagResource

  • publishVersion

  • listVersions

  • createFunctionUrlConfig

  • getFunctionUrlConfig

  • updateFunctionUrlConfig

  • deleteFunctionUrlConfig

  • listFunctionUrlConfigs

  • getFunctionConfiguration

  • updateFunctionConfiguration

  • putFunctionConcurrency

  • deleteFunctionConcurrency

  • getFunctionConcurrency

  • addPermission

  • removePermission

  • getPolicy

invokeFunction

Lambda2Operations

overrideEndpoint (producer)

Whether the Lambda client sends the requests to the URI of the uriEndpointOverride option instead of the Lambda endpoint of the region. It has no effect when uriEndpointOverride is not set.

false

boolean

pojoRequest (producer)

Whether the body is the request of the AWS SDK for the operation, such as an InvokeRequest for invokeFunction or a CreateFunctionRequest for createFunction. If true, the producer sends that request as it is, without the function of the endpoint, the invocationType and logType options or the headers, and a body of another type fails. If false, the producer builds the request from the endpoint, its options and the headers.

false

boolean

region (producer)

The ID of the AWS region of the Lambda service, in lower case, for example eu-west-1 (the value of Region.EU_WEST_1.id()). If not set, the AWS SDK resolves the region itself, for example from the AWS_REGION environment variable.

Enum values:

  • ap-south-2

  • ap-south-1

  • eu-south-1

  • eu-south-2

  • us-gov-east-1

  • me-central-1

  • il-central-1

  • ca-central-1

  • eu-central-1

  • us-iso-west-1

  • eu-central-2

  • eu-isoe-west-1

  • us-west-1

  • us-west-2

  • af-south-1

  • eu-north-1

  • eu-west-3

  • eu-west-2

  • eu-west-1

  • ap-northeast-3

  • ap-northeast-2

  • ap-northeast-1

  • me-south-1

  • sa-east-1

  • ap-east-1

  • cn-north-1

  • ca-west-1

  • us-gov-west-1

  • ap-southeast-1

  • ap-southeast-2

  • us-iso-east-1

  • ap-southeast-3

  • ap-southeast-4

  • us-east-1

  • us-east-2

  • cn-northwest-1

  • us-isob-east-1

  • aws-global

  • aws-cn-global

  • aws-us-gov-global

  • aws-iso-global

  • aws-iso-b-global

String

uriEndpointOverride (producer)

The URI that the Lambda client sends the requests to, for example http://localhost:4566 for a local emulator. It is used only when overrideEndpoint is true.

String

autowiredEnabled (advanced)

Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.

true

boolean

awsLambdaClient (advanced)

Autowired To use a custom software.amazon.awssdk.services.lambda.LambdaClient, which is autowired when the registry has a single one. When this option is set, the credentials, region, proxy, endpoint override and trustAllCertificates options are not used. The endpoint does not close a client that is set or autowired.

LambdaClient

healthCheckConsumerEnabled (health)

Used for enabling or disabling all consumer based health checks from this component.

true

boolean

healthCheckProducerEnabled (health)

Used for enabling or disabling all producer based health checks from this component. Notice: Camel has by default disabled all producer based health-checks. You can turn on producer checks globally by setting camel.health.producersEnabled=true.

true

boolean

proxyHost (proxy)

The host name of the proxy that the Lambda client uses. The client uses a proxy only when the proxyPort option is set too.

String

proxyPort (proxy)

The port of the proxy that the Lambda client uses. The client uses a proxy only when the proxyHost option is set too.

Integer

proxyProtocol (proxy)

The protocol of the proxy that the Lambda client uses. It is used only when the proxyHost and proxyPort options are both set.

Enum values:

  • HTTP

  • HTTPS

HTTPS

Protocol

accessKey (security)

The access key ID of the AWS credentials, used together with the secretKey option. The endpoint requires it, unless awsLambdaClient is set or useDefaultCredentialsProvider or useProfileCredentialsProvider is true. It is also required when useSessionCredentials is true.

String

profileCredentialsName (security)

The name of the profile in the AWS shared credentials and config files, used when useProfileCredentialsProvider is true. If not set, the AWS SDK uses its default profile, which the AWS_PROFILE environment variable can change.

String

secretKey (security)

The secret access key of the AWS credentials, used together with the accessKey option. The endpoint requires it, unless awsLambdaClient is set or useDefaultCredentialsProvider or useProfileCredentialsProvider is true. It is also required when useSessionCredentials is true.

String

sessionToken (security)

The session token of temporary AWS credentials, for example of an assumed IAM role. It is used only when useSessionCredentials is true, together with the accessKey and secretKey options. All three are then required: if one of the three is missing, creating the client fails.

String

trustAllCertificates (security)

Whether the Lambda client accepts any TLS certificate of the server without checking it. It applies whether or not the endpoint is overridden. Use it only for tests, for example with a local emulator.

false

boolean

useDefaultCredentialsProvider (security)

Whether to load the credentials with the default credentials provider chain of the AWS SDK, which looks in system properties, environment variables, the shared credentials and config files, and the container or instance role. It takes precedence over the other credentials options.

false

boolean

useProfileCredentialsProvider (security)

Whether to load the credentials from a profile of the AWS shared credentials and config files, the one of the profileCredentialsName option. It is not used when useDefaultCredentialsProvider is true, and it takes precedence over the session and static credentials.

false

boolean

useSessionCredentials (security)

Whether to use temporary credentials made of the accessKey, secretKey and sessionToken options, for example those of an assumed IAM role. It is not used when useDefaultCredentialsProvider or useProfileCredentialsProvider is true.

false

boolean

Endpoint Options

The AWS Lambda endpoint is configured using URI syntax:

aws2-lambda:function

With the following path and query parameters:

Path Parameters

Name Description Default Type

function (producer)

Required The name or ARN of the Lambda function that the operation works on, for example my-function or arn:aws:lambda:us-east-1:123456789012:function:my-function. For invokeFunction, a version or alias can follow after a colon, such as my-function:prod. listFunctions, deleteEventSourceMapping, listTags, tagResource and untagResource do not use it.

String

Query Parameters

Name Description Default Type

invocationType (producer)

How invokeFunction invokes the function. RequestResponse waits until the function has finished and gives its result. Event queues the event for an asynchronous invocation and answers at once with status code 202 and an empty body. DryRun only checks that the function can be invoked (status code 204). The CamelAwsLambdaInvocationType header overrides it per message. Not used with pojoRequest.

Enum values:

  • RequestResponse

  • Event

  • DryRun

RequestResponse

String

logType (producer)

Set to Tail to get the last 4 KB of the execution log of a RequestResponse invocation in the CamelAwsLambdaLogResult header (base64-encoded). The CamelAwsLambdaLogType header overrides it per message. Not used with pojoRequest.

Enum values:

  • None

  • Tail

None

String

operation (producer)

The operation that the producer performs. The CamelAwsLambdaOperation header replaces this option.

Enum values:

  • listFunctions

  • getFunction

  • createAlias

  • deleteAlias

  • getAlias

  • listAliases

  • createFunction

  • deleteFunction

  • invokeFunction

  • updateFunction

  • createEventSourceMapping

  • deleteEventSourceMapping

  • listEventSourceMapping

  • listTags

  • tagResource

  • untagResource

  • publishVersion

  • listVersions

  • createFunctionUrlConfig

  • getFunctionUrlConfig

  • updateFunctionUrlConfig

  • deleteFunctionUrlConfig

  • listFunctionUrlConfigs

  • getFunctionConfiguration

  • updateFunctionConfiguration

  • putFunctionConcurrency

  • deleteFunctionConcurrency

  • getFunctionConcurrency

  • addPermission

  • removePermission

  • getPolicy

invokeFunction

Lambda2Operations

overrideEndpoint (producer)

Whether the Lambda client sends the requests to the URI of the uriEndpointOverride option instead of the Lambda endpoint of the region. It has no effect when uriEndpointOverride is not set.

false

boolean

pojoRequest (producer)

Whether the body is the request of the AWS SDK for the operation, such as an InvokeRequest for invokeFunction or a CreateFunctionRequest for createFunction. If true, the producer sends that request as it is, without the function of the endpoint, the invocationType and logType options or the headers, and a body of another type fails. If false, the producer builds the request from the endpoint, its options and the headers.

false

boolean

region (producer)

The ID of the AWS region of the Lambda service, in lower case, for example eu-west-1 (the value of Region.EU_WEST_1.id()). If not set, the AWS SDK resolves the region itself, for example from the AWS_REGION environment variable.

Enum values:

  • ap-south-2

  • ap-south-1

  • eu-south-1

  • eu-south-2

  • us-gov-east-1

  • me-central-1

  • il-central-1

  • ca-central-1

  • eu-central-1

  • us-iso-west-1

  • eu-central-2

  • eu-isoe-west-1

  • us-west-1

  • us-west-2

  • af-south-1

  • eu-north-1

  • eu-west-3

  • eu-west-2

  • eu-west-1

  • ap-northeast-3

  • ap-northeast-2

  • ap-northeast-1

  • me-south-1

  • sa-east-1

  • ap-east-1

  • cn-north-1

  • ca-west-1

  • us-gov-west-1

  • ap-southeast-1

  • ap-southeast-2

  • us-iso-east-1

  • ap-southeast-3

  • ap-southeast-4

  • us-east-1

  • us-east-2

  • cn-northwest-1

  • us-isob-east-1

  • aws-global

  • aws-cn-global

  • aws-us-gov-global

  • aws-iso-global

  • aws-iso-b-global

String

uriEndpointOverride (producer)

The URI that the Lambda client sends the requests to, for example http://localhost:4566 for a local emulator. It is used only when overrideEndpoint is true.

String

lazyStartProducer (producer (advanced))

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

boolean

awsLambdaClient (advanced)

Autowired To use a custom software.amazon.awssdk.services.lambda.LambdaClient, which is autowired when the registry has a single one. When this option is set, the credentials, region, proxy, endpoint override and trustAllCertificates options are not used. The endpoint does not close a client that is set or autowired.

LambdaClient

proxyHost (proxy)

The host name of the proxy that the Lambda client uses. The client uses a proxy only when the proxyPort option is set too.

String

proxyPort (proxy)

The port of the proxy that the Lambda client uses. The client uses a proxy only when the proxyHost option is set too.

Integer

proxyProtocol (proxy)

The protocol of the proxy that the Lambda client uses. It is used only when the proxyHost and proxyPort options are both set.

Enum values:

  • HTTP

  • HTTPS

HTTPS

Protocol

accessKey (security)

The access key ID of the AWS credentials, used together with the secretKey option. The endpoint requires it, unless awsLambdaClient is set or useDefaultCredentialsProvider or useProfileCredentialsProvider is true. It is also required when useSessionCredentials is true.

String

profileCredentialsName (security)

The name of the profile in the AWS shared credentials and config files, used when useProfileCredentialsProvider is true. If not set, the AWS SDK uses its default profile, which the AWS_PROFILE environment variable can change.

String

secretKey (security)

The secret access key of the AWS credentials, used together with the accessKey option. The endpoint requires it, unless awsLambdaClient is set or useDefaultCredentialsProvider or useProfileCredentialsProvider is true. It is also required when useSessionCredentials is true.

String

sessionToken (security)

The session token of temporary AWS credentials, for example of an assumed IAM role. It is used only when useSessionCredentials is true, together with the accessKey and secretKey options. All three are then required: if one of the three is missing, creating the client fails.

String

trustAllCertificates (security)

Whether the Lambda client accepts any TLS certificate of the server without checking it. It applies whether or not the endpoint is overridden. Use it only for tests, for example with a local emulator.

false

boolean

useDefaultCredentialsProvider (security)

Whether to load the credentials with the default credentials provider chain of the AWS SDK, which looks in system properties, environment variables, the shared credentials and config files, and the container or instance role. It takes precedence over the other credentials options.

false

boolean

useProfileCredentialsProvider (security)

Whether to load the credentials from a profile of the AWS shared credentials and config files, the one of the profileCredentialsName option. It is not used when useDefaultCredentialsProvider is true, and it takes precedence over the session and static credentials.

false

boolean

useSessionCredentials (security)

Whether to use temporary credentials made of the accessKey, secretKey and sessionToken options, for example those of an assumed IAM role. It is not used when useDefaultCredentialsProvider or useProfileCredentialsProvider is true.

false

boolean

Message Headers

The AWS Lambda component supports the following message header(s), which is/are listed below:

Name Description Default Type

CamelAwsLambdaOperation (all)

Constant: OPERATION

Required The operation to perform. It replaces the operation option of the endpoint.

String

CamelAwsLambdaS3Bucket (createFunction)

Constant: S3_BUCKET

The name of the Amazon S3 bucket that holds the deployment package (the .zip file) of the function, used together with CamelAwsLambdaS3Key. The bucket must be in the same AWS region as the function. updateFunction uses it too. It cannot be combined with CamelAwsLambdaZipFile.

String

CamelAwsLambdaS3Key (createFunction)

Constant: S3_KEY

The key of the Amazon S3 object that is the deployment package (the .zip file) of the function, used together with CamelAwsLambdaS3Bucket. updateFunction uses it too.

String

CamelAwsLambdaS3ObjectVersion (createFunction)

Constant: S3_OBJECT_VERSION

The version of the Amazon S3 object of the deployment package, for a versioned bucket. It needs CamelAwsLambdaS3Bucket and CamelAwsLambdaS3Key. updateFunction uses it too.

String

CamelAwsLambdaZipFile (createFunction)

Constant: ZIP_FILE

The path of a local .zip file that is the deployment package of the function. updateFunction uses it too. It cannot be combined with the S3 headers. Without this header and the S3 headers, the message body is the .zip file.

String

CamelAwsLambdaDescription (createFunction)

Constant: DESCRIPTION

The description of the function. updateFunctionConfiguration uses it too.

String

CamelAwsLambdaRole (createFunction)

Constant: ROLE

Required The ARN of the execution role of the function: the IAM role that Lambda assumes to run the function and access other AWS resources. updateFunctionConfiguration uses it too, where it is optional.

String

CamelAwsLambdaRuntime (createFunction)

Constant: RUNTIME

Required The identifier of the runtime of the function, for example nodejs22.x, java21 or python3.13.

String

CamelAwsLambdaHandler (createFunction)

Constant: HANDLER

Required The method in the code that Lambda calls to run the function. For Node.js it is file-name.export-name, for example index.handler; for Java it is package.Class::method or package.Class.

String

CamelAwsLambdaTargetArn (createFunction)

Constant: TARGET_ARN

The ARN of the Amazon SQS queue or Amazon SNS topic that is the dead-letter queue of the function: Lambda sends to it the events of asynchronous invocations that fail.

String

CamelAwsLambdaMemorySize (createFunction)

Constant: MEMORY_SIZE

The amount of memory, in MB, available to the function at runtime. More memory also gives the function more CPU. The value can be any multiple of 1 MB; Lambda uses 128 MB if not set.

Integer

CamelAwsLambdaKMSKeyArn (createFunction)

Constant: KMS_KEY_ARN

The ARN of the AWS KMS customer managed key that encrypts the environment variables of the function. If not set, Lambda uses an AWS owned key or an AWS managed key.

String

CamelAwsLambdaEnvironmentVariables (createFunction)

Constant: ENVIRONMENT_VARIABLES

The environment variables of the function, as a Map of names to values. updateFunctionConfiguration uses it too.

Map

CamelAwsLambdaPublish (createFunction updateFunction)

Constant: PUBLISH

Whether to publish a version of the function: for createFunction, the first version, together with the function; for updateFunction, a new version after the code is updated.

Boolean

CamelAwsLambdaTimeout (createFunction)

Constant: TIMEOUT

The time, in seconds, that Lambda allows the function to run before it stops it. The default is 3 seconds and the maximum is 900 seconds.

Integer

CamelAwsLambdaTags (createFunction)

Constant: TAGS

The tags of the new function, as a Map of keys to values.

Map

CamelAwsLambdaTracingConfig (createFunction)

Constant: TRACING_CONFIG

The AWS X-Ray tracing mode of the function: Active or PassThrough.

String

CamelAwsLambdaSecurityGroupIds (createFunction)

Constant: SECURITY_GROUP_IDS

The IDs of the security groups of the function in a VPC, as a List. Set it, together with CamelAwsLambdaSubnetIds, to connect the function to a VPC.

List

CamelAwsLambdaSubnetIds (createFunction)

Constant: SUBNET_IDS

The IDs of the subnets of the function in a VPC, as a List. Set it, together with CamelAwsLambdaSecurityGroupIds, to connect the function to a VPC.

List

CamelAwsLambdaEventSourceArn (createEventSourceMapping)

Constant: EVENT_SOURCE_ARN

The ARN of the event source, for example of an Amazon SQS queue, an Amazon Kinesis stream or a DynamoDB stream. Required.

String

CamelAwsLambdaEventSourceBatchSize (createEventSourceMapping)

Constant: EVENT_SOURCE_BATCH_SIZE

The maximum number of records in each batch that Lambda reads from the stream or queue and sends to the function. If not set, Lambda uses the default of the event source, for example 10 for Amazon SQS and 100 for Amazon Kinesis.

Integer

CamelAwsLambdaEventSourceUuid (deleteEventSourceMapping)

Constant: EVENT_SOURCE_UUID

The UUID of the event source mapping to delete. Required.

String

CamelAwsLambdaResourceArn (listTags tagResource untagResource)

Constant: RESOURCE_ARN

The ARN of the function whose tags to list, add or remove. Required. Lambda does not support tags on an alias or a version.

String

CamelAwsLambdaResourceTags (tagResource)

Constant: RESOURCE_TAGS

The tags to add to the function, as a Map of keys to values. Required.

Map

CamelAwsLambdaResourceTagKeys (untagResource)

Constant: RESOURCE_TAG_KEYS

The keys of the tags to remove from the function, as a List. Required.

List

CamelAwsLambdaVersionDescription (publishVersion)

Constant: VERSION_DESCRIPTION

The description of the version. If not set, the version has the description of the function.

String

CamelAwsLambdaVersionRevisionId (publishVersion)

Constant: VERSION_REVISION_ID

Publish the version only if the revision ID of the function matches this ID, so that no version is published when the function configuration changed since you last read it.

String

CamelAwsLambdaFunctionVersion (createAlias listAliases)

Constant: FUNCTION_VERSION

For createAlias, the function version that the alias points to, which is required. For listAliases, only the aliases that point to this version are listed.

String

CamelAwsLambdaAliasFunctionName (createAlias deleteAlias getAlias)

Constant: FUNCTION_ALIAS_NAME

Required The name of the alias. Required.

String

CamelAwsLambdaAliasFunctionDescription (createAlias)

Constant: FUNCTION_ALIAS_DESCRIPTION

The description of the alias.

String

CamelAwsLambdaMarker (listFunctions listVersions listAliases listEventSourceMapping listTags)

Constant: MARKER

The pagination token. Set it to the value of this header that a previous list returned, to get the next page. listFunctions, listVersions, listAliases and listFunctionUrlConfigs set it to the token of the next page, or to null when there are no more results.

String

CamelAwsLambdaMaxItems (listFunctions listVersions listAliases listEventSourceMapping)

Constant: MAX_ITEMS

The maximum number of items to return. listFunctions, listVersions and listFunctionUrlConfigs return at most 50 items per call, even if this value is higher.

Integer

CamelAwsLambdaIsTruncated (listFunctions listVersions listAliases listEventSourceMapping)

Constant: IS_TRUNCATED

Whether more results are available: true when the response has the token of a next page in CamelAwsLambdaMarker.

Boolean

CamelAwsLambdaFunctionArn (createFunction getFunction publishVersion createAlias getAlias)

Constant: FUNCTION_ARN

The ARN of the function, set by createFunction, getFunctionConfiguration, updateFunctionConfiguration, createFunctionUrlConfig, getFunctionUrlConfig and updateFunctionUrlConfig.

String

CamelAwsLambdaStatusCode (invokeFunction)

Constant: STATUS_CODE

The HTTP status code of the function invocation: 200 for RequestResponse, 202 for Event and 204 for DryRun.

Integer

CamelAwsLambdaFunctionError (invokeFunction)

Constant: FUNCTION_ERROR

If present, indicates that an error occurred during function execution. The exchange does not fail: the body is the JSON of the error.

String

CamelAwsLambdaLogResult (invokeFunction)

Constant: LOG_RESULT

The last 4 KB of the execution log, base64-encoded. Lambda returns it only when the log type is Tail (the logType option or the CamelAwsLambdaLogType header).

String

CamelAwsLambdaInvocationType (invokeFunction)

Constant: INVOCATION_TYPE

How to invoke the function: RequestResponse, Event or DryRun. Overrides the invocationType option.

String

CamelAwsLambdaLogType (invokeFunction)

Constant: LOG_TYPE

Set to Tail to get the last 4 KB of the execution log in the CamelAwsLambdaLogResult header, or None. Overrides the logType option.

String

CamelAwsLambdaFunctionUrlAuthType (createFunctionUrlConfig updateFunctionUrlConfig)

Constant: FUNCTION_URL_AUTH_TYPE

Required The type of authentication of the function URL: AWS_IAM allows only authenticated IAM users and roles, NONE makes the URL public, so that anyone can invoke the function. Required for createFunctionUrlConfig; updateFunctionUrlConfig changes the type only when it is set.

String

CamelAwsLambdaFunctionUrlQualifier (createFunctionUrlConfig updateFunctionUrlConfig getFunctionUrlConfig deleteFunctionUrlConfig)

Constant: FUNCTION_URL_QUALIFIER

The qualifier of the function. For the function URL operations, the name of an alias; without it, they work on the function URL of the unqualified function. getFunctionConfiguration, addPermission, removePermission and getPolicy use it too, as a version number or an alias name.

String

CamelAwsLambdaFunctionUrlCorsAllowCredentials (createFunctionUrlConfig updateFunctionUrlConfig)

Constant: FUNCTION_URL_CORS_ALLOW_CREDENTIALS

Whether the function URL allows cookies or other credentials in cross-origin (CORS) requests. Lambda defaults to false.

String

CamelAwsLambdaFunctionUrlCorsAllowOrigins (createFunctionUrlConfig updateFunctionUrlConfig)

Constant: FUNCTION_URL_CORS_ALLOW_ORIGINS

The origins that can access the function URL in cross-origin (CORS) requests, as a List, for example https://www.example.com, or * for all origins.

List

CamelAwsLambdaFunctionUrlCorsAllowMethods (createFunctionUrlConfig updateFunctionUrlConfig)

Constant: FUNCTION_URL_CORS_ALLOW_METHODS

The HTTP methods allowed in cross-origin (CORS) requests to the function URL, as a List, for example GET and POST, or * for all methods.

List

CamelAwsLambdaFunctionUrlCorsAllowHeaders (createFunctionUrlConfig updateFunctionUrlConfig)

Constant: FUNCTION_URL_CORS_ALLOW_HEADERS

The HTTP headers that cross-origin (CORS) requests to the function URL can include, as a List.

List

CamelAwsLambdaFunctionUrlCorsExposeHeaders (createFunctionUrlConfig updateFunctionUrlConfig)

Constant: FUNCTION_URL_CORS_EXPOSE_HEADERS

The HTTP headers of the function response that browsers expose to the origins of cross-origin (CORS) requests, as a List.

List

CamelAwsLambdaFunctionUrlCorsMaxAge (createFunctionUrlConfig updateFunctionUrlConfig)

Constant: FUNCTION_URL_CORS_MAX_AGE

The time, in seconds, that browsers can cache the result of a CORS preflight request to the function URL. Lambda defaults to 0, which means no caching.

Integer

CamelAwsLambdaFunctionUrl (createFunctionUrlConfig getFunctionUrlConfig)

Constant: FUNCTION_URL

The URL of the function URL, the HTTPS endpoint that invokes the function, set by createFunctionUrlConfig, getFunctionUrlConfig and updateFunctionUrlConfig.

String

CamelAwsLambdaFunctionMemorySize (updateFunctionConfiguration)

Constant: FUNCTION_MEMORY_SIZE

The amount of memory available to the function at runtime. Increasing the function memory also increases its CPU allocation. The default value is 128 MB. The value can be any multiple of 1 MB.

Integer

CamelAwsLambdaFunctionTimeout (updateFunctionConfiguration)

Constant: FUNCTION_TIMEOUT

The amount of time (in seconds) that Lambda allows a function to run before stopping it. The default is 3 seconds. The maximum allowed value is 900 seconds.

Integer

CamelAwsLambdaFunctionRuntime (updateFunctionConfiguration)

Constant: FUNCTION_RUNTIME

The new runtime of the function, for example java21.

String

CamelAwsLambdaFunctionHandler (updateFunctionConfiguration)

Constant: FUNCTION_HANDLER

The new handler of the function: the method in the code that Lambda calls to run the function.

String

CamelAwsLambdaReservedConcurrentExecutions (putFunctionConcurrency)

Constant: RESERVED_CONCURRENT_EXECUTIONS

Required The number of simultaneous executions to reserve for the function.

Integer

CamelAwsLambdaStatementId (addPermission)

Constant: STATEMENT_ID

Required The ID of the statement in the resource-based policy of the function: of the new statement for addPermission, of the statement to remove for removePermission. Required.

String

CamelAwsLambdaAction (addPermission)

Constant: ACTION

Required The action that the principal can use on the function. For example, lambda:InvokeFunction or lambda:GetFunction.

String

CamelAwsLambdaPrincipal (addPermission)

Constant: PRINCIPAL

Required The Amazon Web Services service, Amazon Web Services account, IAM user, or IAM role that invokes the function. For example, s3.amazonaws.com or 123456789012.

String

CamelAwsLambdaSourceAccount (addPermission)

Constant: SOURCE_ACCOUNT

The Amazon Web Services account ID of the principal.

String

CamelAwsLambdaSourceArn (addPermission)

Constant: SOURCE_ARN

The ARN of the Amazon Web Services resource that invokes the function. For example, an Amazon S3 bucket or Amazon SNS topic.

String

Message Body

The message body at each side of the AWS Lambda component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.

Side Body Description

Producer input

any

The payload of invokeFunction, the default, as JSON text: bytes and a stream are sent as they are, a file is read as text, a Map or a POJO is sent as its toString(), so marshal it first, and no body invokes the function without a payload. createFunction and updateFunction take the code from the CamelAwsLambdaZipFile header or the S3 headers, which win over the body, else the body is the zip of the code as bytes, a stream or a file, and a body that does not convert to bytes fails. The other operations take their input from headers, or with pojoRequest=true from the request of the AWS SDK in the body.

  • With operation=invokeFunction: text, bytes, stream, file or null

  • With operation=createFunction: bytes, stream, file or null

  • With operation=updateFunction: bytes, stream, file or null

Producer output

pojo

The response of the AWS SDK for the operation, such as a ListFunctionsResponse. For invokeFunction, the default, the payload of the response as text: the JSON the function returns, or the JSON of its error with the CamelAwsLambdaFunctionError header set, as an error of the function does not fail the exchange.

  • With operation=invokeFunction: text (java.lang.String)

The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.

Required Lambda component options

You have to provide the awsLambdaClient in the Registry or your accessKey and secretKey to access the Amazon Lambda service.

Usage

Static credentials, Default Credential Provider and Profile Credentials Provider

You have the possibility of avoiding the usage of explicit static credentials by specifying the useDefaultCredentialsProvider option and set it to true.

The order of evaluation for Default Credentials Provider is the following:

  • Java system properties - aws.accessKeyId and aws.secretKey.

  • Environment variables - AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

  • Web Identity Token from AWS STS.

  • The shared credentials and config files.

  • Amazon ECS container credentials - loaded from the Amazon ECS if the environment variable AWS_CONTAINER_CREDENTIALS_RELATIVE_URI is set.

  • Amazon EC2 Instance profile credentials.

You have also the possibility of using Profile Credentials Provider, by specifying the useProfileCredentialsProvider option to true and profileCredentialsName to the profile name.

Only one of static, default and profile credentials could be used at the same time.

For more information about this you can look at AWS credentials documentation

List of Available Operations

  • listFunctions

  • getFunction

  • createFunction

  • deleteFunction

  • invokeFunction

  • updateFunction

  • createEventSourceMapping

  • deleteEventSourceMapping

  • listEventSourceMapping

  • listTags

  • tagResource

  • untagResource

  • publishVersion

  • listVersions

  • createAlias

  • deleteAlias

  • getAlias

  • listAliases

  • createFunctionUrlConfig

  • getFunctionUrlConfig

  • updateFunctionUrlConfig

  • deleteFunctionUrlConfig

  • listFunctionUrlConfigs

  • getFunctionConfiguration

  • updateFunctionConfiguration

  • putFunctionConcurrency

  • deleteFunctionConcurrency

  • getFunctionConcurrency

  • addPermission

  • removePermission

  • getPolicy

Examples

Producer Example

To have a full understanding of how the component works, you may have a look at these integration tests

Producer Examples

  • CreateFunction: this operation will create a function for you in AWS Lambda

  • Java

  • XML

  • YAML

from("direct:createFunction")
    .to("aws2-lambda://GetHelloWithName?operation=createFunction")
    .to("mock:result");
<route>
  <from uri="direct:createFunction"/>
  <to uri="aws2-lambda://GetHelloWithName?operation=createFunction"/>
  <to uri="mock:result"/>
</route>
- route:
    from:
      uri: direct:createFunction
      steps:
        - to:
            uri: aws2-lambda://GetHelloWithName
            parameters:
              operation: createFunction
        - to:
            uri: mock:result

and by sending

Java-only: Java test API (ProducerTemplate with file upload)
template.send("direct:createFunction", ExchangePattern.InOut, exchange -> {
    exchange.getIn().setHeader("CamelAwsLambdaRuntime", "nodejs22.x");
    exchange.getIn().setHeader("CamelAwsLambdaHandler", "GetHelloWithName.handler");
    exchange.getIn().setHeader("CamelAwsLambdaDescription", "Hello with node.js on Lambda");
    exchange.getIn().setHeader("CamelAwsLambdaRole",
            "arn:aws:iam::643534317684:role/lambda-execution-role");

    ClassLoader classLoader = getClass().getClassLoader();
    File file = new File(
            classLoader
                    .getResource("org/apache/camel/component/aws2/lambda/function/node/GetHelloWithName.zip")
                    .getFile());
    exchange.getIn().setBody(new FileInputStream(file));
});

The code of the function is the zip file of the CamelAwsLambdaZipFile header, or the S3 location of the CamelAwsLambdaS3Bucket and CamelAwsLambdaS3Key headers (and optionally CamelAwsLambdaS3ObjectVersion). When neither is set, the message body is the zip, as bytes, a stream or a file. A body that does not convert to bytes fails the exchange, and text is sent as its bytes, which AWS rejects as not a zip. The updateFunction operation takes the code in the same way. The zip file header and the S3 headers cannot be used together, and the S3 location needs both the bucket and the key.

  • InvokeFunction: this operation invokes the function with the message body as the payload

The body is sent as the payload: a byte[] or a stream as it is, any other body as text in UTF-8. Without a body the function is invoked without a payload. The body of the reply is the payload the function returned, as a String.

An error of the function does not fail the exchange: the body is the JSON of the error that the function returned, and the CamelAwsLambdaFunctionError header is set (for example to Unhandled). Check this header, for example with a filter or a choice, to handle the error.

By default, invokeFunction waits until the function has finished (invocation type RequestResponse). Set invocationType=Event to invoke the function asynchronously: Lambda queues the event and answers at once, with the CamelAwsLambdaStatusCode header set to 202 and an empty body; the result of the function is not returned. Set invocationType=DryRun to only check that the function can be invoked (status code 204). With logType=Tail, the CamelAwsLambdaLogResult header holds the last 4 KB of the execution log of a RequestResponse invocation, base64-encoded. The CamelAwsLambdaInvocationType and CamelAwsLambdaLogType headers override the options per message. With pojoRequest=true, the InvokeRequest in the body is sent as it is.

from("direct:start")
    .to("aws2-lambda://GetHelloWithName?operation=invokeFunction&invocationType=Event");

Function URL Operations

Function URLs provide a dedicated HTTP(S) endpoint for your Lambda function, enabling direct invocation via HTTP without needing API Gateway.

  • createFunctionUrlConfig: this operation will create a function URL for your Lambda function

  • Java

  • XML

  • YAML

from("direct:createFunctionUrl")
    .setHeader("CamelAwsLambdaFunctionUrlAuthType", constant("NONE"))
    .to("aws2-lambda://myFunction?operation=createFunctionUrlConfig")
    .to("mock:result");
<route>
    <from uri="direct:createFunctionUrl"/>
    <setHeader name="CamelAwsLambdaFunctionUrlAuthType">
        <constant>NONE</constant>
    </setHeader>
    <to uri="aws2-lambda://myFunction?operation=createFunctionUrlConfig"/>
    <to uri="mock:result"/>
</route>
- route:
    from:
      uri: direct:createFunctionUrl
      steps:
        - setHeader:
            name: CamelAwsLambdaFunctionUrlAuthType
            constant: NONE
        - to:
            uri: aws2-lambda://myFunction
            parameters:
              operation: createFunctionUrlConfig
        - to:
            uri: mock:result

The FUNCTION_URL_AUTH_TYPE can be either NONE (public access) or AWS_IAM (authenticated access).

  • getFunctionUrlConfig: this operation will retrieve the function URL configuration

  • Java

  • XML

  • YAML

from("direct:getFunctionUrl")
    .to("aws2-lambda://myFunction?operation=getFunctionUrlConfig")
    .to("mock:result");
<route>
    <from uri="direct:getFunctionUrl"/>
    <to uri="aws2-lambda://myFunction?operation=getFunctionUrlConfig"/>
    <to uri="mock:result"/>
</route>
- route:
    from:
      uri: direct:getFunctionUrl
      steps:
        - to:
            uri: aws2-lambda://myFunction
            parameters:
              operation: getFunctionUrlConfig
        - to:
            uri: mock:result
  • updateFunctionUrlConfig: this operation will update the function URL configuration

  • Java

  • XML

  • YAML

from("direct:updateFunctionUrl")
    .setHeader("CamelAwsLambdaFunctionUrlAuthType", constant("AWS_IAM"))
    .to("aws2-lambda://myFunction?operation=updateFunctionUrlConfig")
    .to("mock:result");
<route>
    <from uri="direct:updateFunctionUrl"/>
    <setHeader name="CamelAwsLambdaFunctionUrlAuthType">
        <constant>AWS_IAM</constant>
    </setHeader>
    <to uri="aws2-lambda://myFunction?operation=updateFunctionUrlConfig"/>
    <to uri="mock:result"/>
</route>
- route:
    from:
      uri: direct:updateFunctionUrl
      steps:
        - setHeader:
            name: CamelAwsLambdaFunctionUrlAuthType
            constant: AWS_IAM
        - to:
            uri: aws2-lambda://myFunction
            parameters:
              operation: updateFunctionUrlConfig
        - to:
            uri: mock:result
  • deleteFunctionUrlConfig: this operation will delete the function URL

  • Java

  • XML

  • YAML

from("direct:deleteFunctionUrl")
    .to("aws2-lambda://myFunction?operation=deleteFunctionUrlConfig")
    .to("mock:result");
<route>
    <from uri="direct:deleteFunctionUrl"/>
    <to uri="aws2-lambda://myFunction?operation=deleteFunctionUrlConfig"/>
    <to uri="mock:result"/>
</route>
- route:
    from:
      uri: direct:deleteFunctionUrl
      steps:
        - to:
            uri: aws2-lambda://myFunction
            parameters:
              operation: deleteFunctionUrlConfig
        - to:
            uri: mock:result
  • listFunctionUrlConfigs: this operation will list all function URLs for a function

  • Java

  • XML

  • YAML

from("direct:listFunctionUrls")
    .to("aws2-lambda://myFunction?operation=listFunctionUrlConfigs")
    .to("mock:result");
<route>
    <from uri="direct:listFunctionUrls"/>
    <to uri="aws2-lambda://myFunction?operation=listFunctionUrlConfigs"/>
    <to uri="mock:result"/>
</route>
- route:
    from:
      uri: direct:listFunctionUrls
      steps:
        - to:
            uri: aws2-lambda://myFunction
            parameters:
              operation: listFunctionUrlConfigs
        - to:
            uri: mock:result

Function Configuration Operations

Function Configuration operations allow you to view and modify your Lambda function’s runtime settings.

  • getFunctionConfiguration: this operation will retrieve the configuration details of a function

  • Java

  • XML

  • YAML

from("direct:getFunctionConfiguration")
    .to("aws2-lambda://myFunction?operation=getFunctionConfiguration")
    .to("mock:result");
<route>
    <from uri="direct:getFunctionConfiguration"/>
    <to uri="aws2-lambda://myFunction?operation=getFunctionConfiguration"/>
    <to uri="mock:result"/>
</route>
- route:
    from:
      uri: direct:getFunctionConfiguration
      steps:
        - to:
            uri: aws2-lambda://myFunction
            parameters:
              operation: getFunctionConfiguration
        - to:
            uri: mock:result
  • updateFunctionConfiguration: this operation will update the configuration of a function

  • Java

  • XML

  • YAML

from("direct:updateFunctionConfiguration")
    .setHeader("CamelAwsLambdaFunctionMemorySize", constant(512))
    .setHeader("CamelAwsLambdaFunctionTimeout", constant(60))
    .setHeader("CamelAwsLambdaDescription", constant("Updated function description"))
    .to("aws2-lambda://myFunction?operation=updateFunctionConfiguration")
    .to("mock:result");
<route>
    <from uri="direct:updateFunctionConfiguration"/>
    <setHeader name="CamelAwsLambdaFunctionMemorySize">
        <constant resultType="java.lang.Integer">512</constant>
    </setHeader>
    <setHeader name="CamelAwsLambdaFunctionTimeout">
        <constant resultType="java.lang.Integer">60</constant>
    </setHeader>
    <setHeader name="CamelAwsLambdaDescription">
        <constant>Updated function description</constant>
    </setHeader>
    <to uri="aws2-lambda://myFunction?operation=updateFunctionConfiguration"/>
    <to uri="mock:result"/>
</route>
- route:
    from:
      uri: direct:updateFunctionConfiguration
      steps:
        - setHeader:
            name: CamelAwsLambdaFunctionMemorySize
            constant: "512"
        - setHeader:
            name: CamelAwsLambdaFunctionTimeout
            constant: "60"
        - setHeader:
            name: CamelAwsLambdaDescription
            constant: Updated function description
        - to:
            uri: aws2-lambda://myFunction
            parameters:
              operation: updateFunctionConfiguration
        - to:
            uri: mock:result

Concurrency Operations

Concurrency operations allow you to manage reserved concurrency for your Lambda functions.

  • putFunctionConcurrency: this operation will set the reserved concurrency for a function

  • Java

  • XML

  • YAML

from("direct:putFunctionConcurrency")
    .setHeader("CamelAwsLambdaReservedConcurrentExecutions", constant(100))
    .to("aws2-lambda://myFunction?operation=putFunctionConcurrency")
    .to("mock:result");
<route>
    <from uri="direct:putFunctionConcurrency"/>
    <setHeader name="CamelAwsLambdaReservedConcurrentExecutions">
        <constant>100</constant>
    </setHeader>
    <to uri="aws2-lambda://myFunction?operation=putFunctionConcurrency"/>
    <to uri="mock:result"/>
</route>
- route:
    from:
      uri: direct:putFunctionConcurrency
      steps:
        - setHeader:
            name: CamelAwsLambdaReservedConcurrentExecutions
            constant: "100"
        - to:
            uri: aws2-lambda://myFunction
            parameters:
              operation: putFunctionConcurrency
        - to:
            uri: mock:result
  • deleteFunctionConcurrency: this operation will remove reserved concurrency from a function

  • Java

  • XML

  • YAML

from("direct:deleteFunctionConcurrency")
    .to("aws2-lambda://myFunction?operation=deleteFunctionConcurrency")
    .to("mock:result");
<route>
    <from uri="direct:deleteFunctionConcurrency"/>
    <to uri="aws2-lambda://myFunction?operation=deleteFunctionConcurrency"/>
    <to uri="mock:result"/>
</route>
- route:
    from:
      uri: direct:deleteFunctionConcurrency
      steps:
        - to:
            uri: aws2-lambda://myFunction
            parameters:
              operation: deleteFunctionConcurrency
        - to:
            uri: mock:result
  • getFunctionConcurrency: this operation will retrieve the reserved concurrency for a function

  • Java

  • XML

  • YAML

from("direct:getFunctionConcurrency")
    .to("aws2-lambda://myFunction?operation=getFunctionConcurrency")
    .to("mock:result");
<route>
    <from uri="direct:getFunctionConcurrency"/>
    <to uri="aws2-lambda://myFunction?operation=getFunctionConcurrency"/>
    <to uri="mock:result"/>
</route>
- route:
    from:
      uri: direct:getFunctionConcurrency
      steps:
        - to:
            uri: aws2-lambda://myFunction
            parameters:
              operation: getFunctionConcurrency
        - to:
            uri: mock:result

Permission Operations

Permission operations allow you to manage the resource-based policy for your Lambda functions.

  • addPermission: this operation will add a permission to the function’s resource-based policy

  • Java

  • XML

  • YAML

from("direct:addPermission")
    .setHeader("CamelAwsLambdaStatementId", constant("s3-invoke"))
    .setHeader("CamelAwsLambdaAction", constant("lambda:InvokeFunction"))
    .setHeader("CamelAwsLambdaPrincipal", constant("s3.amazonaws.com"))
    .setHeader("CamelAwsLambdaSourceArn", constant("arn:aws:s3:::my-bucket"))
    .to("aws2-lambda://myFunction?operation=addPermission")
    .to("mock:result");
<route>
    <from uri="direct:addPermission"/>
    <setHeader name="CamelAwsLambdaStatementId">
        <constant>s3-invoke</constant>
    </setHeader>
    <setHeader name="CamelAwsLambdaAction">
        <constant>lambda:InvokeFunction</constant>
    </setHeader>
    <setHeader name="CamelAwsLambdaPrincipal">
        <constant>s3.amazonaws.com</constant>
    </setHeader>
    <setHeader name="CamelAwsLambdaSourceArn">
        <constant>arn:aws:s3:::my-bucket</constant>
    </setHeader>
    <to uri="aws2-lambda://myFunction?operation=addPermission"/>
    <to uri="mock:result"/>
</route>
- route:
    from:
      uri: direct:addPermission
      steps:
        - setHeader:
            name: CamelAwsLambdaStatementId
            constant: s3-invoke
        - setHeader:
            name: CamelAwsLambdaAction
            constant: "lambda:InvokeFunction"
        - setHeader:
            name: CamelAwsLambdaPrincipal
            constant: s3.amazonaws.com
        - setHeader:
            name: CamelAwsLambdaSourceArn
            constant: "arn:aws:s3:::my-bucket"
        - to:
            uri: aws2-lambda://myFunction
            parameters:
              operation: addPermission
        - to:
            uri: mock:result
  • removePermission: this operation will remove a permission from the function’s resource-based policy

  • Java

  • XML

  • YAML

from("direct:removePermission")
    .setHeader("CamelAwsLambdaStatementId", constant("s3-invoke"))
    .to("aws2-lambda://myFunction?operation=removePermission")
    .to("mock:result");
<route>
    <from uri="direct:removePermission"/>
    <setHeader name="CamelAwsLambdaStatementId">
        <constant>s3-invoke</constant>
    </setHeader>
    <to uri="aws2-lambda://myFunction?operation=removePermission"/>
    <to uri="mock:result"/>
</route>
- route:
    from:
      uri: direct:removePermission
      steps:
        - setHeader:
            name: CamelAwsLambdaStatementId
            constant: s3-invoke
        - to:
            uri: aws2-lambda://myFunction
            parameters:
              operation: removePermission
        - to:
            uri: mock:result
  • getPolicy: this operation will retrieve the resource-based policy for a function

  • Java

  • XML

  • YAML

from("direct:getPolicy")
    .to("aws2-lambda://myFunction?operation=getPolicy")
    .to("mock:result");
<route>
    <from uri="direct:getPolicy"/>
    <to uri="aws2-lambda://myFunction?operation=getPolicy"/>
    <to uri="mock:result"/>
</route>
- route:
    from:
      uri: direct:getPolicy
      steps:
        - to:
            uri: aws2-lambda://myFunction
            parameters:
              operation: getPolicy
        - to:
            uri: mock:result

You can also configure CORS settings for function URLs:

Java-only: requires List values for CORS headers
from("direct:createFunctionUrlWithCors")
    .process(exchange -> {
        exchange.getIn().setHeader("CamelAwsLambdaFunctionUrlAuthType", "NONE");
        exchange.getIn().setHeader("CamelAwsLambdaFunctionUrlCorsAllowOrigins",
            List.of("https://example.com"));
        exchange.getIn().setHeader("CamelAwsLambdaFunctionUrlCorsAllowMethods",
            List.of("GET", "POST"));
        exchange.getIn().setHeader("CamelAwsLambdaFunctionUrlCorsAllowHeaders",
            List.of("Content-Type", "Authorization"));
        exchange.getIn().setHeader("CamelAwsLambdaFunctionUrlCorsMaxAge", 3600);
    })
    .to("aws2-lambda://myFunction?operation=createFunctionUrlConfig")
    .to("mock:result");

Using a POJO as body

Sometimes building an AWS Request can be complex because of multiple options. We introduce the possibility to use a POJO as the body. In AWS Lambda there are multiple operations you can submit, as an example for Get Function request, you can do something like:

Java-only: requires AWS SDK builder
from("direct:getFunction")
     .setBody(GetFunctionRequest.builder().functionName("test").build())
     .to("aws2-lambda://GetHelloWithName?awsLambdaClient=#awsLambdaClient&operation=getFunction&pojoRequest=true")

In this way, you’ll pass the request directly without the need of passing headers and options specifically related to this operation.

Dependencies

Maven users will need to add the following dependency to their pom.xml.

pom.xml

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-aws2-lambda</artifactId>
    <version>${camel-version}</version>
</dependency>

where ${camel-version} must be replaced by the actual version of Camel.