Package software.amazon.awscdk.services.s3objectlambda.alpha
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 software.amazon.awscdk.services.lambda.*; import software.amazon.awscdk.services.s3.*; import software.amazon.awscdk.services.s3objectlambda.alpha.*; import software.amazon.awscdk.*; Stack stack = new Stack(); Bucket bucket = new Bucket(stack, "MyBucket"); Function handler = Function.Builder.create(stack, "MyFunction") .runtime(Runtime.NODEJS_LATEST) .handler("index.handler") .code(Code.fromAsset("lambda.zip")) .build(); AccessPoint.Builder.create(stack, "MyObjectLambda") .bucket(bucket) .handler(handler) .accessPointName("my-access-point") .payload(Map.of( "prop", "value")) .build();
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 software.amazon.awscdk.services.lambda.*; import software.amazon.awscdk.services.s3.*; import software.amazon.awscdk.services.s3objectlambda.alpha.*; import software.amazon.awscdk.*; Stack stack = new Stack(); Bucket bucket = new Bucket(stack, "MyBucket"); Function handler = Function.Builder.create(stack, "MyFunction") .runtime(Runtime.NODEJS_LATEST) .handler("index.handler") .code(Code.fromAsset("lambda.zip")) .build(); AccessPoint.Builder.create(stack, "MyObjectLambda") .bucket(bucket) .handler(handler) .accessPointName("my-access-point") .supportsGetObjectRange(true) .supportsGetObjectPartNumber(true) .build();
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 software.amazon.awscdk.services.lambda.*; import software.amazon.awscdk.services.s3.*; import software.amazon.awscdk.services.s3objectlambda.alpha.*; import software.amazon.awscdk.*; Stack stack = new Stack(); Bucket bucket = new Bucket(stack, "MyBucket"); Function handler = Function.Builder.create(stack, "MyFunction") .runtime(Runtime.NODEJS_LATEST) .handler("index.handler") .code(Code.fromAsset("lambda.zip")) .build(); AccessPoint.Builder.create(stack, "MyObjectLambda") .bucket(bucket) .handler(handler) .accessPointName("my-access-point") .payload(Map.of( "prop", "value")) .build();
-
ClassDescription(experimental) An S3 object lambda access point for intercepting and transforming
GetObject
requests.(experimental) A fluent builder forAccessPoint
.(experimental) The access point resource attributes.A builder forAccessPointAttributes
An implementation forAccessPointAttributes
(experimental) The S3 object lambda access point configuration.A builder forAccessPointProps
An implementation forAccessPointProps
(experimental) The interface that represents the AccessPoint resource.Internal default implementation forIAccessPoint
.A proxy class which represents a concrete javascript instance of this type.