Notification Service Amazon Simple

Transcription

Amazon SimpleNotification ServiceDeveloper Guide

Amazon Simple Notification Service Developer GuideAmazon Simple Notification Service: Developer GuideCopyright Amazon Web Services, Inc. and/or its affiliates. All rights reserved.Amazon's trademarks and trade dress may not be used in connection with any product or service that is notAmazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages ordiscredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who mayor may not be affiliated with, connected to, or sponsored by Amazon.

Amazon Simple Notification Service Developer GuideTable of ContentsWhat is Amazon SNS? . 1Features and capabilities . 3Related services . 4Accessing Amazon SNS . 4Pricing for Amazon SNS . 4Common Amazon SNS scenarios . 5Application integration . 5Application alerts . 5User notifications . 6Mobile push notifications . 6Working with AWS SDKs . 6Amazon SNS event sources and destinations . 7Event sources . 7Analytics . 7Application integration . 7Billing and cost management . 8Business applications . 8Compute . 8Containers . 9Customer engagement . 9Database . 10Developer tools . 10Front-end web & mobile . 11Game development . 11Internet of Things . 12Machine learning . 12Management & governance . 13Media . 14Migration & transfer . 14Networking & content delivery . 14Security, identity, & compliance . 15Serverless . 16Storage . 16Additional event sources . 17Event destinations . 17A2A destinations . 17A2P destinations . 18Setting up . 20Create account and an IAM administrator user . 20Create an IAM user and get credentials . 20Next steps . 21Getting started . 22Prerequisites . 22Step 1: Create a topic . 22Step 2: Create a subscription to the topic . 22Step 3: Publish a message to the topic . 23Step 4: Delete the subscription and topic . 23Next steps . 23Configuring Amazon SNS . 24Creating a topic . 24AWS Management Console . 24AWS SDKs . 26Subscribing to a topic . 31To subscribe an endpoint to an Amazon SNS topic . 31iii

Amazon Simple Notification Service Developer GuideDeleting a subscription and topic .AWS Management Console .AWS SDKs .Tagging .Tagging for cost allocation .Tagging for access control .Tagging for resource searching and filtering .Configuring tags .Message ordering and deduplication (FIFO topics) .FIFO topics use case .Message ordering details .Message grouping .Message delivery .Message filtering .Message deduplication .Message security .Message durability .Code examples .FIFO example (AWS SDKs) .FIFO example (AWS CloudFormation) .Message publishing .AWS Management Console .AWS SDKs .Large message payloads .Prerequisites .Example: Publishing messages to Amazon SNS with payload stored in Amazon S3 .Other endpoint protocols .Message attributes .Message attribute items and validation .Data types .Reserved message attributes for mobile push notifications .Message batching .What is message batching? .How does message batching work? .Examples .Message filtering .Subscription filter policies .Example filter policies .Filter policy constraints .Attribute string value matching .Attribute numeric value matching .Attribute key matching .AND/OR logic .Applying a subscription filter policy .AWS Management Console .AWS CLI .AWS SDKs .Amazon SNS API .AWS CloudFormation .Removing a subscription filter policy .AWS Management Console .AWS CLI .Amazon SNS API .Message delivery .Raw message delivery .Enabling raw message delivery using the AWS Management Console .Message format examples 99090909091919192

Amazon Simple Notification Service Developer GuideCross-account delivery . 92Queue owner creates subscription . 92A user who does not own the queue creates a subscription . 94How do I force a subscription to require authentication on unsubscribe requests? . 96Cross-region delivery . 96Opt-in Regions . 96Message delivery status . 98Configuring delivery status logging using the AWS Management Console . 98Configuring message delivery status attributes for topics subscribed to Amazon SNS endpointsusing the AWS SDKs . 99Message delivery retries . 103Delivery protocols and policies . 103Delivery policy stages . 104Creating an HTTP/S delivery policy . 105Dead-letter queues (DLQs) . 107Why do message deliveries fail? . 108How do dead-letter queues work? . 109How are messages moved into a dead-letter queue? . 109How can I move messages out of a dead-letter queue? . 109How can I monitor and log dead-letter queues? . 109Configuring a dead-letter queue . 110Message archiving and analytics . 114Application-to-application (A2A) messaging . 115Fanout to Kinesis Data Firehose delivery streams . 115Prerequisites . 115Subscribing a delivery stream to a topic . 117Delivery stream destinations . 117Example use case . 126Fanout to Lambda functions . 135Prerequisites . 135Subscribing a function to a topic . 135Fanout to Amazon SQS queues . 136Subscribing a queue to a topic . 136Example (AWS CloudFormation) . 141Fanout to HTTP/S endpoints . 146Subscribing an endpoint to a topic . 147Verifying message signatures . 153Parsing message formats . 155Fanout to AWS Event Fork Pipelines . 161How AWS Event Fork Pipelines works . 162Deploying AWS Event Fork Pipelines . 164Deploying and testing AWS Event Fork Pipelines . 165Subscribing an event pipeline to a topic . 171Application-to-person (A2P) messaging . 178Mobile text messaging (SMS) . 178SMS sandbox . 179Origination identities . 181Requesting SMS support . 199Setting SMS preferences . 206Sending SMS messages . 210Monitoring SMS activity . 220Managing SMS subscriptions . 226Supported Regions and countries . 239SMS best practices . 248SMS requirements for Singapore . 251SMS requirements for US destinations . 252SMS requirements for India . 252v

Amazon Simple Notification Service Developer GuideMobile push notifications .How user notifications work .User notification process overview .Setting up a mobile app .Sending mobile push notifications .Mobile app attributes .Mobile app events .Mobile push API actions .Mobile push API errors .Mobile push TTL .Supported Regions .Mobile push notifications best practices .Email notifications .AWS Management Console .AWS SDKs .Code examples .Actions .Add tags to a topic .Check whether a phone number is opted out .Confirm an endpoint owner wants to receive messages .Create a topic .Delete a subscription .Delete a topic .Get the properties of a topic .Get the settings for sending SMS messages .List opted out phone numbers .List the subscribers of a topic .List topics .Publish an SMS text message .Publish to a topic .Set a dead-letter queue for a subscription .Set a filter policy .Set the default settings for sending SMS messages .Set topic attributes .Subscribe a Lambda function to a topic .Subscribe a mobile application to a topic .Subscribe an HTTP endpoint to a topic .Subscribe an email address to a topic .Scenarios .Create a platform endpoint for push notifications .Create and publish to a FIFO topic .Publish SMS messages to a topic .Publish a large message .Cross-service examples .Build an app to submit data to a DynamoDB table .Building an Amazon SNS application .Create an Amazon Textract explorer application .Detect people and objects in a video .Use API Gateway to invoke a Lambda function .Use scheduled events to invoke a Lambda function .Security .Data protection .Data encryption .Internetwork traffic privacy .Identity and access management .Authentication .Access control 376378378379387399399400

Amazon Simple Notification Service Developer GuideOverview .Using identity-based policies .Using temporary credentials .API permissions reference .

Pipelines. For more information, see Application-to-application (A2A) messaging (p. 112). Application-to-person notifications Application-to-person notifications provide user notifications to subscribers such as mobile applications, mobile phone numbers, and email addresses. For more information, see Application-to-person (A2P) messaging .