A destination for events that were processed successfully.
To declare this entity in your AWS Serverless Application Model (AWS SAM) template, use the following syntax.
[Destination](#sam-function-onsuccess-destination): String
[Type](#sam-function-onsuccess-type): String
Destination
The Amazon Resource Name (ARN) of the destination resource.
Type: String
Required: Conditional
AWS CloudFormation compatibility: This property is similar to the [OnSuccess](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-eventinvokeconfig-destinationconfig-onsuccess.html#cfn-lambda-eventinvokeconfig-destinationconfig-onsuccess-destination)
property of an AWS::Lambda::EventInvokeConfig
resource. SAM will add any necessary permissions to the auto-generated IAM Role associated with this function to access the resource referenced in this property.
Additional Notes: If the type is Lambda/EventBridge, Destination is required.
Type
Type of the resource referenced in the destination. Supported types are SQS
, SNS
, Lambda
, and EventBridge
.
Type: String
Required: No
AWS CloudFormation compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent.
Additional Notes: If the type is SQS/SNS and the Destination
property is left blank, then the SQS/SNS resource is auto generated by SAM. To reference the resource, use <function-logical-id>.DestinationQueue
for SQS or <function-logical-id>.DestinationTopic
for SNS. If the type is Lambda/EventBridge, Destination
is required.
In this example no Destination is given for the SQS OnSuccess configuration, so SAM implicitly creates a SQS queue and adds any necessary permissions. Also for this example, a Destination for a Lambda resource declared in the template file is specified in the OnFailure configuration, so SAM adds the necessary permissions to this Lambda function to call the destination Lambda function.
EventInvokeConfig:
DestinationConfig:
OnSuccess:
Type: SQS
OnFailure:
Type: Lambda
Destination: !GetAtt DestinationLambda.Arn # Arn of a Lambda function declared in the template file.
In this example a Destination is given for an SNS topic declared in the template file for the OnSuccess configuration.
EventInvokeConfig:
DestinationConfig:
OnSuccess:
Type: SNS
Destination:
Ref: DestinationSNS # Arn of an SNS topic declared in the tempate file