The CDK Construct Library for AWS::S3ObjectLambda
Project description
AWS::S3ObjectLambda Construct Library
---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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aws_cdk_aws_s3objectlambda_alpha-2.237.1a0.tar.gz.
File metadata
- Download URL: aws_cdk_aws_s3objectlambda_alpha-2.237.1a0.tar.gz
- Upload date:
- Size: 54.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bc40a581c5cd20b5eb63bfa1d747de32e7caf7e75df017b39b8ebecaad8eb07
|
|
| MD5 |
96498de82a9662aa351f548699a74315
|
|
| BLAKE2b-256 |
3d5560fe2f8aae3a75b7a8f32784b3a20fb4f3f981780a6b9d7b8a4e87e3bfae
|
File details
Details for the file aws_cdk_aws_s3objectlambda_alpha-2.237.1a0-py3-none-any.whl.
File metadata
- Download URL: aws_cdk_aws_s3objectlambda_alpha-2.237.1a0-py3-none-any.whl
- Upload date:
- Size: 53.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cce57b913243ebc7037056057742e74014a8e251b1bb2f3f7d3f1cb7c14488f
|
|
| MD5 |
4d4822fdf7faa6950ad3a07b809d8b18
|
|
| BLAKE2b-256 |
1f6468ebc94a7e68e4a321fe5079b06d147a23edd2e87fd2760afdb7fa524542
|