Publish

publish Map
The publish section allows services to publish messages to one or more SNS topics.

publish:
  topics:
    - name: orderEvents

In the example above, this manifest declares an SNS topic named orderEvents that other worker services deployed to the Copilot environment can subscribe to. An environment variable named COPILOT_SNS_TOPIC_ARNS is injected into your workload as a JSON string.

In JavaScript, you could write:

const {orderEvents} = JSON.parse(process.env.COPILOT_SNS_TOPIC_ARNS)
For more details, see the pub/sub page.

publish.topics Array of topics
List of topic objects.

publish.topics.topic Map
Holds configuration for a single SNS topic.

publish.topics.topic.name String
Required. The name of the SNS topic. Must contain only upper and lowercase letters, numbers, hyphens, and underscores.

publish.topics.topic.fifo Boolean or Map
FIFO (first in, first out) SNS topic configuration.
If you specify true, Copilot will create the topic with FIFO ordering.

publish:
  topics:
    - name: mytopic
      fifo: true

Alternatively, you can also configure advanced SNS FIFO topic settings.

publish:
  topics:
    - name: mytopic
      fifo:
        content_based_deduplication: true

publish.topics.topic.fifo.content_based_deduplication Boolean
If the message body is guaranteed to be unique for each published message, you can enable content-based deduplication for the SNS FIFO topic.