aws-cdk-lib.aws_lambda_destinations.SnsDestination

class SnsDestination

LanguageType name
.NETAmazon.CDK.AWS.Lambda.Destinations.SnsDestination
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awslambdadestinations#SnsDestination
Javasoftware.amazon.awscdk.services.lambda.destinations.SnsDestination
Pythonaws_cdk.aws_lambda_destinations.SnsDestination
TypeScript (source)aws-cdk-lib » aws_lambda_destinations » SnsDestination

Implements IDestination

Use a SNS topic as a Lambda destination.

Example

// An sns topic for successful invocations of a lambda function
import * as sns from 'aws-cdk-lib/aws-sns';

const myTopic = new sns.Topic(this, 'Topic');

const myFn = new lambda.Function(this, 'Fn', {
  runtime: lambda.Runtime.NODEJS_14_X,
  handler: 'index.handler',
  code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
  // sns topic for successful invocations
  onSuccess: new destinations.SnsDestination(myTopic),
})

Initializer

new SnsDestination(topic: ITopic)

Parameters

  • topic ITopic

Methods

NameDescription
bind(_scope, fn, _options?)Returns a destination configuration.

bind(_scope, fn, _options?)

public bind(_scope: Construct, fn: IFunction, _options?: DestinationOptions): DestinationConfig

Parameters

  • _scope Construct
  • fn IFunction
  • _options DestinationOptions

Returns

  • DestinationConfig

Returns a destination configuration.