A PubSub Topic represents an Amazon SNS Topic. Amazon Simple Notification Service (SNS) is a service capable of publishing and delivering messages to subscribers and other AWS services. Your recipients are subscribed to a topic, which is where you publish your messages to be appropriately formatted and sent them.
Key Features of Amazon SNS include:
- Push-based message delivery to SNS topic subscribers
- Pay-as-you-go pricing model
- Supports message to multiple endpoint types including IOS and Android
- Works well with AWS Lambda to communicate with other AWS services, manipulate messages, or publish to other SNS topics
- Redundant storage of messages across multiple Availability Zones
A PubSub Topic differs from a Job Queue, in the way that the consuming resource receives a message. A Job Queue requires their consumer resources to poll or "pull" messages from a queue, where as a PubSub Topic "pushes" messages instantaneously to subscribed consumer resources.
Along with its instantaneous messaging, a PubSub Topic is essential when decoupling your application and implementing a Pub/Sub message pattern. A resource produces a message which gets published to your PubSub Topic and consumed by any subscribers. Each subscriber specifies the protocol and end-point for these notifications to be sent.
Event subscription wires (solid line) connect two or more resources and are required to accomplish certain tasks or improve performance within an application's flow.
The following resources can be subscribed to a PubSub Topic:
Service discovery wires (dashed line) provide compute resources (Function, Edge Function, Docker Task) with the permissions and environment variables required to perform actions using cloud resources within the stack. This resource is on the receiving end of a service discovery wire originating from compute resources.
The following compute resources can use a service discovery wire to access a PubSub Topic resource:
Human readable name for this resource that is displayed on the Stackery Dashboard and Stackery CLI output.
Use Existing SNS Topic
When enabled, this feature provides you with a field to specify the Amazon Resource Name (ARN) of an existing SNS Topic to reference in your application.
When connected by a service discovery wire (dashed wire), a Function or Docker Task will add the following IAM policy to its role and gain permission to access this resource.
Grants a Function or Docker Task permission to publish a message to a PubSub Topic within the stack or an existing SNS Topic outside of the current stack.
When connected by a service discovery wire (dashed wire), a Function or Docker Task will automatically populate and reference the following environment variables in order to interact with this resource.
The Logical ID of the PubSub Topic resource.
The Amazon Resource Name of the SNS Topic.
Related AWS Documentation
AWS Documentation: AWS::SNS::Topic