Invoking Lambda functions with tenant isolation
When invoking a function that has tenant isolation enabled, you must provide a tenant-id parameter.
This parameter ensures that your function invocation is processed in an execution environment dedicated to that specific tenant.
Invoking functions with tenant isolation (AWS CLI)
Synchronous invocation
For synchronous invocations, add the --tenant-id parameter to your Invoke command:
aws lambda invoke \ --function-nameimage-analysis\ --tenant-idblue\ response.json
Asynchronous invocation
For asynchronous invocations, include both the --tenant-id and --invocation-type Event parameters:
aws lambda invoke \ --function-nameimage-analysis\ --tenant-idblue\ --invocation-type Event \ response.json
Invoking functions with tenant isolation (API)
When using the Invoke API action directly, include the tenant identifier using the X-Amzn-Tenant-Id parameter in your request.
Example API request
POST /2015-03-31/functions/image-analysis/invocations HTTP/1.1 Host: lambda.us-east-1.amazonaws.com Content-Type: application/json Authorization: AWS4-HMAC-SHA256 Credential=...X-Amz-Tenant-Id:blue{ "key1": "value1", "key2": "value2" }
Invoking functions with tenant isolation (API Gateway)
When using API Gateway to trigger tenant-isolated Lambda functions, you can pass the tenant identifier via query parameters or request headers, as shown below:
Using query parameters
Configure your API Gateway integration to pass the tenant ID as a query parameter:
GET /api/process?tenant-id=blue&data=sampleHTTP/1.1 Host:your-api-id.execute-api.us-east-1.amazonaws.com
Using request headers
You can also pass the tenant ID through custom headers:
POST /api/process HTTP/1.1 Host:your-api-id.execute-api.us-east-1.amazonaws.com Content-Type: application/jsonX-Tenant-ID:blue{ "data": "sample payload" }
Invoking functions with tenant isolation (SDK)
When using AWS SDKs to invoke tenant-isolated functions, include the tenant identifier in your invocation request.