Skip to content

Latest commit

 

History

History
94 lines (64 loc) · 4.22 KB

README.md

File metadata and controls

94 lines (64 loc) · 4.22 KB

AWS SDK for Rust code examples for CloudFormation

Purpose

These examples demonstrate how to perform several CloudFormation operations using the alpha version of the AWS SDK for Rust. AWS CloudFormation (CloudFormation) enables you to use a template file to create and delete a collection of resources together as a single unit (a stack).

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 https://github.com/awslabs/aws-sdk-rust.

create-stack

This example creates a CloudFormation stack in the region.

cargo run --bin create-stacks -- -s STACK-NAME -t TEMPLATE-FILE [-d DEFAULT-REGION] [-v]

  • STACK-NAME is name of the stack.
  • TEMPLATE-FILE is name of the template file, in either JSON or YAML format.
  • DEFAULT-REGION is name of the AWS Region, such as us-east-1, where the stacks are located. If not supplied, uses the value of the AWS_DEFAULT_REGION or AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
  • -v displays additional information.

delete-stack

This example deletes a CloudFormation stack in the region.

cargo run --bin delete-stacks -- -s STACK-NAME [-d DEFAULT-REGION] [-v]

  • STACK-NAME is name of the stack.
  • DEFAULT-REGION is name of the AWS Region, such as us-east-1, where the stacks are located. If not supplied, uses the value of the AWS_DEFAULT_REGION or AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
  • -v displays additional information.

describe-stack

This example retrieves the status of a CloudFormation stack in the region.

cargo run --bin describe-stacks -- -s STACK-NAME [-d DEFAULT-REGION] [-v]

  • STACK-NAME is name of the stack. If the stack does not exist, the code panics.
  • DEFAULT-REGION is name of the AWS Region, such as us-east-1, where the stacks are located. If not supplied, uses the value of the AWS_DEFAULT_REGION or AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
  • -v displays additional information.

list-stacks

This example lists the name and status of your CloudFormation stacks in the region.

cargo run --bin list-stacks -- [-d DEFAULT-REGION] [-v]

  • DEFAULT-REGION is name of the AWS Region, such as us-east-1, where the stacks are located. If not supplied, uses the value of the AWS_DEFAULT_REGION or 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