Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

AWS::S3ObjectLambda Construct Library

---

cdk-constructs: Experimental

The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.


This construct library allows you to define S3 object lambda access points.

import aws_cdk.aws_lambda as lambda_
import aws_cdk.aws_s3 as s3
import aws_cdk.aws_s3objectlambda_alpha as s3objectlambda
import aws_cdk as cdk

stack = cdk.Stack()
bucket = s3.Bucket(stack, "MyBucket")
handler = lambda_.Function(stack, "MyFunction",
    runtime=lambda_.Runtime.NODEJS_LATEST,
    handler="index.handler",
    code=lambda_.Code.from_asset("lambda.zip")
)
s3objectlambda.AccessPoint(stack, "MyObjectLambda",
    bucket=bucket,
    handler=handler,
    access_point_name="my-access-point",
    payload={
        "prop": "value"
    }
)

Handling range and part number requests

Lambdas are currently limited to only transforming GetObject requests. However, they can additionally support GetObject-Range and GetObject-PartNumber requests, which needs to be specified in the access point configuration:

import aws_cdk.aws_lambda as lambda_
import aws_cdk.aws_s3 as s3
import aws_cdk.aws_s3objectlambda_alpha as s3objectlambda
import aws_cdk as cdk

stack = cdk.Stack()
bucket = s3.Bucket(stack, "MyBucket")
handler = lambda_.Function(stack, "MyFunction",
    runtime=lambda_.Runtime.NODEJS_LATEST,
    handler="index.handler",
    code=lambda_.Code.from_asset("lambda.zip")
)
s3objectlambda.AccessPoint(stack, "MyObjectLambda",
    bucket=bucket,
    handler=handler,
    access_point_name="my-access-point",
    supports_get_object_range=True,
    supports_get_object_part_number=True
)

Pass additional data to Lambda function

You can specify an additional object that provides supplemental data to the Lambda function used to transform objects. The data is delivered as a JSON payload to the Lambda:

import aws_cdk.aws_lambda as lambda_
import aws_cdk.aws_s3 as s3
import aws_cdk.aws_s3objectlambda_alpha as s3objectlambda
import aws_cdk as cdk

stack = cdk.Stack()
bucket = s3.Bucket(stack, "MyBucket")
handler = lambda_.Function(stack, "MyFunction",
    runtime=lambda_.Runtime.NODEJS_LATEST,
    handler="index.handler",
    code=lambda_.Code.from_asset("lambda.zip")
)
s3objectlambda.AccessPoint(stack, "MyObjectLambda",
    bucket=bucket,
    handler=handler,
    access_point_name="my-access-point",
    payload={
        "prop": "value"
    }
)

Accessing the S3 AccessPoint ARN

If you need access to the s3 accesspoint, you can get its ARN like so:

import aws_cdk.aws_s3objectlambda_alpha as s3objectlambda

# access_point: s3objectlambda.AccessPoint
s3_access_point_arn = access_point.s3_access_point_arn

This is only supported for AccessPoints created in the stack - currently you're unable to get the S3 AccessPoint ARN for imported AccessPoints. To do that you'd have to know the S3 bucket name beforehand.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws_cdk_aws_s3objectlambda_alpha-2.266.0a0.tar.gz (56.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file aws_cdk_aws_s3objectlambda_alpha-2.266.0a0.tar.gz.

File metadata

File hashes

Hashes for aws_cdk_aws_s3objectlambda_alpha-2.266.0a0.tar.gz
Algorithm Hash digest
SHA256 241d1fd97a92528b935f5353c7891cde76eec94d6403be0cd066923f8265acb1
MD5 a2d0ccd738180b74efba80ba1d7ea506
BLAKE2b-256 b3b5153cea63049087df7509dd5788bf756db5c0db04d81ed43bd67d71982bda

See more details on using hashes here.

File details

Details for the file aws_cdk_aws_s3objectlambda_alpha-2.266.0a0-py3-none-any.whl.

File metadata

File hashes

Hashes for aws_cdk_aws_s3objectlambda_alpha-2.266.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 bd020af3aac254170e3fcfaf3b250ed2b34e6c36a4c19aa96b017d57c40ae3ff
MD5 7f2a6431ab79093630a87f206d91d703
BLAKE2b-256 0591e95c57c023c616af83e04523b9974c8b31b9b41884275a8ae7843cdb69b2

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.266.0a0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page