ExAws.Cloudformation v2.0.0 ExAws.Cloudformation View Source

Operations on Cloudformation

Basic Usage

alias ExAws.Cloudformation

# Create a stack with name with parameters
Cloudformation.create_stack("name",
[parameters:
  [
    [parameter_key: "AvailabilityZone", parameter_value: "us-east-1"],
    [parameter_key: "InstanceType", parameter_value: "m1.micro"]
  ]]) |> ExAws.request!

# Delete a stack
Cloudformation.delete_stack("name", [role_arn: "aws:iam::blah:role/god"])
|> ExAws.request(region: "us-east-1")

General notes

All options are handled as underscore_atoms instead of camelcased binaries as specified in the CloudFormation API, I.E ‘:role_arn’ would be ‘RoleARN’.

http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_Operations.html

Link to this section Summary

Functions

Cancels an update on the specified stack

Rollbacks a stack in UPDATE_ROLLBACK_FAILED state until the state changes to UPDATE_ROLLBACK_COMPLETE state

Creates a stack as specified in a template

Describes a specified stack’s resource. Resource of the stack is specified by a logical record ID

Describes specified stack’s resources. You either have to specify a stack name or a physical resource ID

Returns the description for the specified stack; if no stack name was specified, then it returns the description for all the stacks created

Gets the template body for a specified stack. Can get a template for running or deleted stacks

Gets information about a new or existing template. Useful for viewing parameter information, such as default parameter values and parameter types

Lists summary of all of the resources for a specified stack

Gets the summary information for stacks. If no :stack_status_filters are passed in, then all stacks are returned (existing and stacks have have been deleted in the last 90 days)

Link to this section Types

Link to this type continue_update_rollback_opts() View Source
continue_update_rollback_opts() :: [role_arn: binary(), skip_resources: [binary(), ...]]
Link to this type create_stack_opts() View Source
create_stack_opts() :: [capabilities: [binary(), ...], disable_rollback: boolean(), notification_arns: [binary(), ...], on_failure: binary(), parameters: [parameter(), ...], resource_types: [binary(), ...], role_arn: binary(), stack_policy_body: binary(), stack_policy_url: binary(), tags: [tag(), ...], template_body: binary(), template_url: binary(), timeout_in_minutes: integer()]
Link to this type delete_stack_opts() View Source
delete_stack_opts() :: [retain_resources: [binary(), ...], role_arn: binary()]
Link to this type describe_stack_resources_opts() View Source
describe_stack_resources_opts() :: [stack_name: binary(), logical_resource_id: binary(), physical_resource_id: binary()]
Link to this type describe_stacks_opts() View Source
describe_stacks_opts() :: [stack_name: binary(), next_token: binary()]
Link to this type get_template_opts() View Source
get_template_opts() :: [change_set_name: binary(), stack_name: binary(), template_stage: [:original | :processed]]
Link to this type get_template_summary_opts() View Source
get_template_summary_opts() :: [stack_name: binary(), template_body: binary(), template_url: binary()]
Link to this type list_stacks_opts() View Source
list_stacks_opts() :: [next_token: binary(), stack_status_filters: [ExAws.Cloudformation.Parsers.stack_status(), ...]]
Link to this type parameter() View Source
parameter() :: [parameter_key: binary(), parameter_value: binary(), use_previous_value: boolean()]
Link to this type tag() View Source
tag() :: {key :: atom() | binary(), value :: binary()}

Link to this section Functions

Link to this function cancel_update_stack(stack_name) View Source
cancel_update_stack(stack_name :: binary()) :: ExAws.Operation.Query.t()

Cancels an update on the specified stack.

Please read: http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CancelUpdateStack.html

Examples:

Cloudformation.cancel_update_stack("Test")
Link to this function continue_update_rollback(stack_name, opts \\ []) View Source
continue_update_rollback(stack_name :: binary(), opts :: continue_update_rollback_opts()) :: ExAws.Operation.Query.t()

Rollbacks a stack in UPDATE_ROLLBACK_FAILED state until the state changes to UPDATE_ROLLBACK_COMPLETE state.

Please read: http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ContinueUpdateRollback.html

Examples:

Cloudformation.continue_update_rollback("Test", [role_arn: "aws:iam:test"])

Cloudformation.continue_update_rollback("test_stack", [skip_resources: ["test_resource_1", "test_resource_2"]])

Cloudformation.continue_update_rollback("test_stack", [role_arn: "arn:my:thing", skip_resources: ["test_resource_1", "test_resource_2"]]
Link to this function create_stack(stack_name, opts \\ []) View Source
create_stack(stack_name :: binary(), opts :: create_stack_opts()) :: ExAws.Operation.Query.t()

Creates a stack as specified in a template.

Please read: http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateStack.html

Examples:

# Create stack from a template url
Cloudformation.create_stack("stack_name", [template_url: "https://s3.amazonaws.com/sample.json"])

# Create stack with parameters
Cloudformation.create_stack("test_stack",
[parameters: [[parameter_key: "AvailabilityZone", parameter_value: "us-east-1a"],
[parameter_key: "InstanceType", parameter_value: "m1.micro"]]])
Link to this function delete_stack(stack_name, opts \\ []) View Source
delete_stack(stack_name :: binary(), opts :: delete_stack_opts()) :: ExAws.Operation.Query.t()

Deletes a stack

Please read: http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_DeleteStack.html

Examples:


# Deletes a stack
Cloudformation.delete_stack("stack_name")

# Deletes a stack by stack name with a RoleARN
Cloudformation.delete_stack("stack_name", [role_arn: "aws:iam:123456:role/test"])

# Deletes a stack except for a couple of resources
Cloudformation.delete_stack("stack_name", [retain_resources: ["test_resource_1", "test_resource_2"]])
Link to this function describe_stack_resource(stack_name, logical_resource_id) View Source
describe_stack_resource(stack_name :: binary(), logical_resource_id :: binary()) :: ExAws.Operation.Query.t()

Describes a specified stack’s resource. Resource of the stack is specified by a logical record ID.

Please read: http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_DescribeStackResource.html

Examples:

Cloudformation.describe_stack_resource("Test", "logical_resource_Id")
Link to this function describe_stack_resources(opts \\ []) View Source
describe_stack_resources(opts :: describe_stack_resources_opts()) :: ExAws.Operation.Query.t()

Describes specified stack’s resources. You either have to specify a stack name or a physical resource ID.

Please read: http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_DescribeStackResources.html

Example:

# Describe resources by stack name
Cloudformation.describe_stack_resources([stack_name: "Test"])

# Describe resources with a logical resource ID
Cloudformation.describe_stack_resources([stack_name: "Test", logical_resource_id: "test_resource_id"])

# Describe resources with a physical resource ID
Cloudformation.describe_stack_resources([physical_resource_id: "test_resource_id"])
Link to this function describe_stacks(opts \\ []) View Source
describe_stacks(opts :: describe_stacks_opts()) :: ExAws.Operation.Query.t()

Returns the description for the specified stack; if no stack name was specified, then it returns the description for all the stacks created.

Please read: http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_DescribeStacks.html

Examples:

# Get all stacks
Cloudformation.describe_stacks

# Get a stack called "Test"
Cloudformation.describe_stacks([stack_name: "Test"])
Link to this function get_template(opts \\ []) View Source
get_template(opts :: get_template_opts()) :: ExAws.Operation.Query.t()

Gets the template body for a specified stack. Can get a template for running or deleted stacks.

Please read: http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_GetTemplate.html

Example:

# Get a template with stack name and template stage param
Cloudformation.get_template([stack_name: "Test", template_stage: :processed])
Link to this function get_template_summary(opts \\ []) View Source
get_template_summary(opts :: get_template_summary_opts()) :: ExAws.Operation.Query.t()

Gets information about a new or existing template. Useful for viewing parameter information, such as default parameter values and parameter types

Please read: http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_GetTemplateSummary.html

Example

Get template summary with stack name

Cloudformation.get_template_summary([stack_name: “Test”])

Link to this function list_stack_resources(stack_name, opts \\ []) View Source
list_stack_resources(stack_name :: binary(), opts :: [{:next_token, binary()}]) :: ExAws.Operation.Query.t()

Lists summary of all of the resources for a specified stack

Please read: http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ListStackResources.html

Examples:

Cloudformation.list_stack_resources("test_stack")

Cloudformation.list_stack_resources("test_stack", [next_token: "token"])
Link to this function list_stacks(opts \\ []) View Source
list_stacks(opts :: list_stacks_opts()) :: ExAws.Operation.Query.t()

Gets the summary information for stacks. If no :stack_status_filters are passed in, then all stacks are returned (existing and stacks have have been deleted in the last 90 days)

Please read: http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ListStacks.html

Examples:

# List all stacks
Cloudformation.list_stacks

# List stacks with some stack status filters
Cloudformation.list_stacks([stack_status_filters: [:delete_complete]])