Skip to content

Latest commit

 

History

History
82 lines (55 loc) · 3.48 KB

README.md

File metadata and controls

82 lines (55 loc) · 3.48 KB

AWS SDK for Rust code examples for Amazon SNS

Purpose

These examples demonstrate how to perform several Amazon Simple Notification Service (Amazon SNS) operations using the developer preview version of the AWS SDK for Rust.

Amazon SNS is a web service that enables applications, end-users, and devices to instantly send and receive notifications from the cloud.

Code examples

⚠ Important

  • We recommend that you grant this code least privilege, or at most the minimum permissions required to perform the task. For more information, see Grant Least Privilege in the AWS Identity and Access Management User Guide.
  • This code has not been tested in all AWS Regions. Some AWS services are available only in specific Regions.
  • Running this code might result in charges to your AWS account.

Running the code examples

Prerequisites

You must have an AWS account, and have configured your default credentials and AWS Region as described in Getting started with the AWS SDK for Rust.

create-topic

This example creates an Amazon SNS topic.

cargo run --bin create-topic -- -t TOPIC_ARN [-r REGION] [-v]

  • TOPIC_ARN is the ARN of the topic.
  • REGION is name of the Region in which the client is created. If not supplied, uses the value of the AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
  • -v displays additional information.

list-topics

This example lists your Amazon SNS topics in the Region.

cargo run --bin list-topics -- [-r REGION] [-v]

  • REGION is name of the Region in which the client is created. If not supplied, uses the value of the AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
  • -v displays additional information.

sns-hello-world

This example subscribes an email address and publishes a message to a topic.

cargo run --bin sns-hello-world -- -e EMAIL_ADDRESS -t TOPIC_ARN [-r REGION] [-v]

  • EMAIL_ADDRESS is the email address to subscribe to a topic. The topic to which the address subscribes is the first in the list of topics.
  • TOPIC_ARN is the ARN of the topic.
  • REGION is name of the Region in which the client is created. If not supplied, uses the value of the AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
  • -v displays additional information.

Resources

Contributing

To propose a new code example to the AWS documentation team, see CONTRIBUTING.md. The team prefers to create code examples that show broad scenarios rather than individual API calls.

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0