awscdks3objectlambdaalpha

package module
v2.17.0-alpha.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

README

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 * as lambda from 'aws-cdk-lib/aws-lambda';
import * as s3 from 'aws-cdk-lib/aws-s3';
import * as s3objectlambda from '@aws-cdk/aws-s3objectlambda-alpha';
import * as cdk from 'aws-cdk-lib';

const stack = new cdk.Stack();
const bucket = new s3.Bucket(stack, 'MyBucket');
const handler = new lambda.Function(stack, 'MyFunction', {
	runtime: lambda.Runtime.NODEJS_14_X,
	handler: 'index.handler',
	code: lambda.Code.fromAsset('lambda.zip'),
});
new s3objectlambda.AccessPoint(stack, 'MyObjectLambda', {
	bucket,
	handler,
	accessPointName: '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 * as lambda from 'aws-cdk-lib/aws-lambda';
import * as s3 from 'aws-cdk-lib/aws-s3';
import * as s3objectlambda from '@aws-cdk/aws-s3objectlambda-alpha';
import * as cdk from 'aws-cdk-lib';

const stack = new cdk.Stack();
const bucket = new s3.Bucket(stack, 'MyBucket');
const handler = new lambda.Function(stack, 'MyFunction', {
	runtime: lambda.Runtime.NODEJS_14_X,
	handler: 'index.handler',
	code: lambda.Code.fromAsset('lambda.zip'),
});
new s3objectlambda.AccessPoint(stack, 'MyObjectLambda', {
	bucket,
	handler,
	accessPointName: 'my-access-point',
	supportsGetObjectRange: true,
	supportsGetObjectPartNumber: 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 * as lambda from 'aws-cdk-lib/aws-lambda';
import * as s3 from 'aws-cdk-lib/aws-s3';
import * as s3objectlambda from '@aws-cdk/aws-s3objectlambda-alpha';
import * as cdk from 'aws-cdk-lib';

const stack = new cdk.Stack();
const bucket = new s3.Bucket(stack, 'MyBucket');
const handler = new lambda.Function(stack, 'MyFunction', {
	runtime: lambda.Runtime.NODEJS_14_X,
	handler: 'index.handler',
	code: lambda.Code.fromAsset('lambda.zip'),
});
new s3objectlambda.AccessPoint(stack, 'MyObjectLambda', {
	bucket,
	handler,
	accessPointName: 'my-access-point',
	payload: {
		prop: "value",
	},
});

Documentation

Overview

The CDK Construct Library for AWS::S3ObjectLambda

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessPoint_IsConstruct

func AccessPoint_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead

func AccessPoint_IsResource

func AccessPoint_IsResource(construct constructs.IConstruct) *bool

Check whether the given construct is a Resource. Experimental.

func NewAccessPoint_Override

func NewAccessPoint_Override(a AccessPoint, scope constructs.Construct, id *string, props *AccessPointProps)

Experimental.

Types

type AccessPoint

type AccessPoint interface {
	awscdk.Resource
	IAccessPoint
	AccessPointArn() *string
	AccessPointCreationDate() *string
	AccessPointName() *string
	DomainName() *string
	Env() *awscdk.ResourceEnvironment
	Node() constructs.Node
	PhysicalName() *string
	RegionalDomainName() *string
	Stack() awscdk.Stack
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	GeneratePhysicalName() *string
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	GetResourceNameAttribute(nameAttr *string) *string
	ToString() *string
	VirtualHostedUrlForObject(key *string, options *awss3.VirtualHostedStyleUrlOptions) *string
}

An S3 object lambda access point for intercepting and transforming `GetObject` requests.

TODO: EXAMPLE

Experimental.

func NewAccessPoint

func NewAccessPoint(scope constructs.Construct, id *string, props *AccessPointProps) AccessPoint

Experimental.

type AccessPointAttributes

type AccessPointAttributes struct {
	// The ARN of the access point.
	// Experimental.
	AccessPointArn *string `json:"accessPointArn" yaml:"accessPointArn"`
	// The creation data of the access point.
	// Experimental.
	AccessPointCreationDate *string `json:"accessPointCreationDate" yaml:"accessPointCreationDate"`
}

The access point resource attributes.

TODO: EXAMPLE

Experimental.

type AccessPointProps

type AccessPointProps struct {
	// The bucket to which this access point belongs.
	// Experimental.
	Bucket awss3.IBucket `json:"bucket" yaml:"bucket"`
	// The Lambda function used to transform objects.
	// Experimental.
	Handler awslambda.IFunction `json:"handler" yaml:"handler"`
	// The name of the S3 object lambda access point.
	// Experimental.
	AccessPointName *string `json:"accessPointName" yaml:"accessPointName"`
	// Whether CloudWatch metrics are enabled for the access point.
	// Experimental.
	CloudWatchMetricsEnabled *bool `json:"cloudWatchMetricsEnabled" yaml:"cloudWatchMetricsEnabled"`
	// Additional JSON that provides supplemental data passed to the Lambda function on every request.
	// Experimental.
	Payload *map[string]interface{} `json:"payload" yaml:"payload"`
	// Whether the Lambda function can process `GetObject-PartNumber` requests.
	// Experimental.
	SupportsGetObjectPartNumber *bool `json:"supportsGetObjectPartNumber" yaml:"supportsGetObjectPartNumber"`
	// Whether the Lambda function can process `GetObject-Range` requests.
	// Experimental.
	SupportsGetObjectRange *bool `json:"supportsGetObjectRange" yaml:"supportsGetObjectRange"`
}

The S3 object lambda access point configuration.

TODO: EXAMPLE

Experimental.

type IAccessPoint

type IAccessPoint interface {
	awscdk.IResource
	// The virtual hosted-style URL of an S3 object through this access point.
	//
	// Specify `regional: false` at the options for non-regional URL.
	//
	// Returns: an ObjectS3Url token
	// Experimental.
	VirtualHostedUrlForObject(key *string, options *awss3.VirtualHostedStyleUrlOptions) *string
	// The ARN of the access point.
	// Experimental.
	AccessPointArn() *string
	// The creation data of the access point.
	// Experimental.
	AccessPointCreationDate() *string
	// The IPv4 DNS name of the access point.
	// Experimental.
	DomainName() *string
	// The regional domain name of the access point.
	// Experimental.
	RegionalDomainName() *string
}

The interface that represents the AccessPoint resource. Experimental.

func AccessPoint_FromAccessPointAttributes

func AccessPoint_FromAccessPointAttributes(scope constructs.Construct, id *string, attrs *AccessPointAttributes) IAccessPoint

Reference an existing AccessPoint defined outside of the CDK code. Experimental.

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL