Skip to content

Update SNS field names to match AWS developer guide #438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Removed accidental auto-format
  • Loading branch information
markscamilleri committed May 26, 2023
commit 4421b98cb0f506cccc609b15da6871d3011975aa
14 changes: 6 additions & 8 deletions doc_source/services-rds.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

You can use AWS Lambda to process event notifications from an Amazon Relational Database Service \(Amazon RDS\) database\. Amazon RDS sends notifications to an Amazon Simple Notification Service \(Amazon SNS\) topic, which you can configure to invoke a Lambda function\. Amazon SNS wraps the message from Amazon RDS in its own event document and sends it to your function\.

**Example Amazon RDS message in an Amazon SNS event**
**Example Amazon RDS message in an Amazon SNS event**

```
{
Expand Down Expand Up @@ -30,14 +30,12 @@ You can use AWS Lambda to process event notifications from an Amazon Relational
```

**Topics**

- [Tutorial: Configuring a Lambda function to access Amazon RDS in an Amazon VPC](services-rds-tutorial.md)
- [Configuring the function](#configuration)
+ [Tutorial: Configuring a Lambda function to access Amazon RDS in an Amazon VPC](services-rds-tutorial.md)
+ [Configuring the function](#configuration)

## Configuring the function<a name="configuration"></a>

The following section shows additional configurations and topics we recommend as part of this tutorial\.

- If too many function instances run concurrently, one or more instances may fail to obtain a database connection\. You can use reserved concurrency to limit the maximum concurrency of the function\. Set the reserved concurrency to be less than the number of database connections\. Reserved concurrency also reserves those instances for this function, which may not be ideal\. If you are invoking the Lambda functions from your application, we recommend you write code that limits the number of concurrent instances\. For more information, see [Managing concurrency for a Lambda function](https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html)\.
- For more information on configuring an Amazon RDS database to send notifications, see [Using Amazon RDS event notifications](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.html)\.
- For more information on using Amazon SNS as trigger, see [Using AWS Lambda with Amazon SNS](with-sns.md)\.
+ If too many function instances run concurrently, one or more instances may fail to obtain a database connection\. You can use reserved concurrency to limit the maximum concurrency of the function\. Set the reserved concurrency to be less than the number of database connections\. Reserved concurrency also reserves those instances for this function, which may not be ideal\. If you are invoking the Lambda functions from your application, we recommend you write code that limits the number of concurrent instances\. For more information, see [Managing concurrency for a Lambda function](https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html)\.
+ For more information on configuring an Amazon RDS database to send notifications, see [Using Amazon RDS event notifications](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.html)\.
+ For more information on using Amazon SNS as trigger, see [Using AWS Lambda with Amazon SNS](with-sns.md)\.
16 changes: 7 additions & 9 deletions doc_source/with-sns.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ You can use a Lambda function to process Amazon Simple Notification Service \(Am

Amazon SNS invokes your function [asynchronously](invocation-async.md) with an event that contains a message and metadata\.

**Example Amazon SNS message event**
**Example Amazon SNS message event**

```
{
Expand Down Expand Up @@ -44,17 +44,15 @@ For asynchronous invocation, Lambda queues the message and handles retries\. If

To perform cross\-account Amazon SNS deliveries to Lambda, you must authorize Amazon SNS to invoke your Lambda function\. In turn, Amazon SNS must allow the AWS account with the Lambda function to subscribe to the Amazon SNS topic\. For example, if the Amazon SNS topic is in account A and the Lambda function is in account B, both accounts must grant permissions to the other to access their respective resources\. Since not all the options for setting up cross\-account permissions are available from the AWS Management Console, you must use the AWS Command Line Interface \(AWS CLI\) for setup\.

For more information, see [Fanout to Lambda functions](https://docs.aws.amazon.com/sns/latest/dg/sns-lambda-as-subscriber.html) in the _Amazon Simple Notification Service Developer Guide_\.
For more information, see [Fanout to Lambda functions](https://docs.aws.amazon.com/sns/latest/dg/sns-lambda-as-subscriber.html) in the *Amazon Simple Notification Service Developer Guide*\.

**Input types for Amazon SNS events**

For input type examples for Amazon SNS events in Java, \.NET, and Go, see the following on the AWS GitHub repository:

- [SNSEvent\.java](https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SNSEvent.java)
- [SNSEvent\.cs](https://github.com/aws/aws-lambda-dotnet/blob/master/Libraries/src/Amazon.Lambda.SNSEvents/SNSEvent.cs)
- [sns\.go](https://github.com/aws/aws-lambda-go/blob/master/events/sns.go)
+ [SNSEvent\.java](https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SNSEvent.java)
+ [SNSEvent\.cs](https://github.com/aws/aws-lambda-dotnet/blob/master/Libraries/src/Amazon.Lambda.SNSEvents/SNSEvent.cs)
+ [sns\.go](https://github.com/aws/aws-lambda-go/blob/master/events/sns.go)

**Topics**

- [Tutorial: Using AWS Lambda with Amazon Simple Notification Service](with-sns-example.md)
- [Sample function code](with-sns-create-package.md)
+ [Tutorial: Using AWS Lambda with Amazon Simple Notification Service](with-sns-example.md)
+ [Sample function code](with-sns-create-package.md)
60 changes: 30 additions & 30 deletions sample-apps/java-events/events/sns-notification.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
{
"Records": [
{
"Sns": {
"MessageAttributes": {
"string-att": {
"Type": "String",
"Value": "[\"value\", \"value\"]"
},
"binary-att": {
"Type": "Binary",
"Value": "WyJ2YWx1ZSIsICJ2YWx1ZSJd"
}
},
"SigningCertURL": "https://sns.us-east-2.amazonaws.com/SimpleNotificationService-a86cxmpl4e1f29c941702d737128f7b6.pem",
"MessageId": "476643b1-xmpl-526c-973d-1542ba9af1d6",
"Message": "Updated and expanded documentation for using Lambda with API Gateway, including support for HTTP APIs.",
"Subject": "Latest updates from AWS Lambda",
"UnsubscribeURL": "https://sns.us-east-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-2:123456789012:java-events-topic:dd15418a-xmpl-4cfd-b418-f7fcb08c7ee4",
"Type": "Notification",
"SignatureVersion": "1",
"Signature": "qZTBXMPL1MoX7HS+m/pg5lRzhJFdaTczB2KqZ6fUCMQGHMF7GhLLTxtC4Hkg2sUysGr14fpDSFRU7MBkzmQmRCXsV9odIHlrxAWvzUuCK2eUnVEoMWJWTH5uyZwWlQHllf9zt2f6eKtEu11yGUqCgzZPfTxg/yu3z/t0EKfdCwDmDL6XqzZbeFvk9uOC1ZIDVv/7cdnbjCslhyx7CTMDnJ7eSu8POgVNIgTItmGFXZDziG1LyV5Afw5fhwObAbypTkfmBSrFuEnDtlQUZvsUCqRJHvdm8g1MmcadSmS1YGBy3OI42oJAmNvfxgZ4/H+KPaXDuvqLNfaZa5qzyRULIg==",
"Timestamp": "2020-02-02T12:34:56Z",
"TopicArn": "arn:aws:sns:us-east-2:123456789012:java-events-topic"
},
"EventVersion": "1.0",
"EventSource": "aws:sns",
"EventSubscriptionArn": "arn:aws:sns:us-east-2:123456789012:java-events-topic:dd15418a-xmpl-4cfd-b418-f7fcb08c7ee4"
}
]
}
"Records": [
{
"Sns": {
"MessageAttributes": {
"string-att": {
"Type": "String",
"Value": "[\"value\", \"value\"]"
},
"binary-att": {
"Type": "Binary",
"Value": "WyJ2YWx1ZSIsICJ2YWx1ZSJd"
}
},
"SigningCertURL": "https://sns.us-east-2.amazonaws.com/SimpleNotificationService-a86cxmpl4e1f29c941702d737128f7b6.pem",
"MessageId": "476643b1-xmpl-526c-973d-1542ba9af1d6",
"Message": "Updated and expanded documentation for using Lambda with API Gateway, including support for HTTP APIs.",
"Subject": "Latest updates from AWS Lambda",
"UnsubscribeURL": "https://sns.us-east-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-2:123456789012:java-events-topic:dd15418a-xmpl-4cfd-b418-f7fcb08c7ee4",
"Type": "Notification",
"SignatureVersion": "1",
"Signature": "qZTBXMPL1MoX7HS+m/pg5lRzhJFdaTczB2KqZ6fUCMQGHMF7GhLLTxtC4Hkg2sUysGr14fpDSFRU7MBkzmQmRCXsV9odIHlrxAWvzUuCK2eUnVEoMWJWTH5uyZwWlQHllf9zt2f6eKtEu11yGUqCgzZPfTxg/yu3z/t0EKfdCwDmDL6XqzZbeFvk9uOC1ZIDVv/7cdnbjCslhyx7CTMDnJ7eSu8POgVNIgTItmGFXZDziG1LyV5Afw5fhwObAbypTkfmBSrFuEnDtlQUZvsUCqRJHvdm8g1MmcadSmS1YGBy3OI42oJAmNvfxgZ4/H+KPaXDuvqLNfaZa5qzyRULIg==",
"Timestamp": "2020-02-02T12:34:56Z",
"TopicArn": "arn:aws:sns:us-east-2:123456789012:java-events-topic"
},
"EventVersion": "1.0",
"EventSource": "aws:sns",
"EventSubscriptionArn": "arn:aws:sns:us-east-2:123456789012:java-events-topic:dd15418a-xmpl-4cfd-b418-f7fcb08c7ee4"
}
]
}