stacks

AWS CloudFormation Stack related operations.

class aws_cloudformation.better_boto.stacks.StackIterProxy(iterable: Iterable)[source]

Reference:

aws_cloudformation.better_boto.stacks.describe_stacks(bsm: boto_session_manager.manager.BotoSesManager, name: str) aws_cloudformation.better_boto.stacks.StackIterProxy[source]

Ref:

Returns

StackIterProxy

aws_cloudformation.better_boto.stacks.describe_live_stack(bsm: boto_session_manager.manager.BotoSesManager, name: str) Optional[aws_cloudformation.stack.Stack][source]

Get the detail of given stack (by name), if it not exists, or the existing one is a “DELETED” stack, returns None.

aws_cloudformation.better_boto.stacks.create_stack(bsm: boto_session_manager.manager.BotoSesManager, stack_name: str, template_body: Optional[str] = Sentinel('NOTHING'), template_url: Optional[str] = Sentinel('NOTHING'), parameters: Optional[List[aws_cloudformation.stack.Parameter]] = Sentinel('NOTHING'), disable_rollback: Optional[bool] = Sentinel('NOTHING'), rollback_configuration: Optional[dict] = Sentinel('NOTHING'), timeout_in_minutes: Optional[int] = Sentinel('NOTHING'), notification_arns: Optional[List[str]] = Sentinel('NOTHING'), include_iam: Optional[bool] = Sentinel('NOTHING'), include_named_iam: Optional[bool] = Sentinel('NOTHING'), include_macro: Optional[bool] = Sentinel('NOTHING'), resource_types: Optional[List[str]] = Sentinel('NOTHING'), execution_role_arn: Optional[str] = Sentinel('NOTHING'), on_failure_do_nothing: Optional[bool] = Sentinel('NOTHING'), on_failure_rollback: Optional[bool] = Sentinel('NOTHING'), on_failure_delete: Optional[bool] = Sentinel('NOTHING'), stack_policy_body: Optional[str] = Sentinel('NOTHING'), stack_policy_url: Optional[str] = Sentinel('NOTHING'), tags: Optional[Dict[str, str]] = Sentinel('NOTHING'), client_request_token: Optional[str] = Sentinel('NOTHING'), enable_termination_protection: Optional[bool] = Sentinel('NOTHING')) str[source]

A wrapper provider more user-friendly API and type hint for cloudformation client create_stack method.

Ref:

Returns

stack_id

aws_cloudformation.better_boto.stacks.update_stack(bsm: boto_session_manager.manager.BotoSesManager, stack_name: str, template_body: Optional[str] = Sentinel('NOTHING'), template_url: Optional[str] = Sentinel('NOTHING'), use_previous_template: Optional[bool] = Sentinel('NOTHING'), parameters: Optional[List[aws_cloudformation.stack.Parameter]] = Sentinel('NOTHING'), disable_rollback: Optional[bool] = Sentinel('NOTHING'), rollback_configuration: Optional[dict] = Sentinel('NOTHING'), notification_arns: Optional[List[str]] = Sentinel('NOTHING'), include_iam: Optional[bool] = Sentinel('NOTHING'), include_named_iam: Optional[bool] = Sentinel('NOTHING'), include_macro: Optional[bool] = Sentinel('NOTHING'), resource_types: Optional[List[str]] = Sentinel('NOTHING'), execution_role_arn: Optional[str] = Sentinel('NOTHING'), stack_policy_body: Optional[str] = Sentinel('NOTHING'), stack_policy_url: Optional[str] = Sentinel('NOTHING'), stack_policy_during_update_body: Optional[str] = Sentinel('NOTHING'), stack_policy_during_update_url: Optional[str] = Sentinel('NOTHING'), tags: Optional[Dict[str, str]] = Sentinel('NOTHING'), client_request_token: Optional[str] = Sentinel('NOTHING')) str[source]

A wrapper provider more user-friendly API and type hint for cloudformation client update_stack method.

Ref:

Returns

stack_id

aws_cloudformation.better_boto.stacks.create_change_set(bsm: boto_session_manager.manager.BotoSesManager, stack_name: str, change_set_name: str, template_body: Optional[str] = Sentinel('NOTHING'), template_url: Optional[str] = Sentinel('NOTHING'), use_previous_template: Optional[bool] = Sentinel('NOTHING'), parameters: Optional[List[aws_cloudformation.stack.Parameter]] = Sentinel('NOTHING'), include_iam: Optional[bool] = Sentinel('NOTHING'), include_named_iam: Optional[bool] = Sentinel('NOTHING'), include_macro: Optional[bool] = Sentinel('NOTHING'), resource_types: Optional[List[str]] = Sentinel('NOTHING'), execution_role_arn: Optional[str] = Sentinel('NOTHING'), rollback_configuration: Optional[dict] = Sentinel('NOTHING'), notification_arns: Optional[List[str]] = Sentinel('NOTHING'), tags: Optional[Dict[str, str]] = Sentinel('NOTHING'), client_request_token: Optional[str] = Sentinel('NOTHING'), description: Optional[str] = Sentinel('NOTHING'), change_set_type_is_create: Optional[bool] = Sentinel('NOTHING'), change_set_type_is_update: Optional[bool] = Sentinel('NOTHING'), change_set_type_is_import: Optional[bool] = Sentinel('NOTHING'), resources_to_import: Optional[List[dict]] = Sentinel('NOTHING'), include_nested_stack: Optional[bool] = Sentinel('NOTHING')) Tuple[str, str][source]

A wrapper provider more user-friendly API and type hint for cloudformation client create_change_set method.

Ref:

Returns

stack_id and change_set_id

aws_cloudformation.better_boto.stacks.describe_change_set(bsm: boto_session_manager.manager.BotoSesManager, change_set_name: str, stack_name: Optional[str] = Sentinel('NOTHING'), next_token: Optional[str] = Sentinel('NOTHING')) Optional[aws_cloudformation.stack.ChangeSet][source]

A wrapper provider more user-friendly API and type hint for cloudformation client describe_change_set method.

Ref:

aws_cloudformation.better_boto.stacks.describe_change_set_with_paginator(bsm: boto_session_manager.manager.BotoSesManager, change_set_name: str, stack_name: Optional[str] = Sentinel('NOTHING'), max_items: Optional[int] = 1000, starting_token: Optional[str] = Sentinel('NOTHING')) Optional[aws_cloudformation.stack.ChangeSet][source]

A wrapper provider more user-friendly API and type hint for cloudformation client Paginator.DescribeChangeSet API.

Ref:

aws_cloudformation.better_boto.stacks.execute_change_set(bsm: boto_session_manager.manager.BotoSesManager, change_set_name: str, stack_name: Optional[str] = Sentinel('NOTHING'), client_request_token: Optional[str] = Sentinel('NOTHING'), disable_rollback: Optional[bool] = Sentinel('NOTHING'))[source]

A wrapper provider more user-friendly API and type hint for cloudformation client execute_change_set method.

Ref:

aws_cloudformation.better_boto.stacks.delete_stack(bsm: boto_session_manager.manager.BotoSesManager, stack_name: str, retain_resources: Optional[List[str]] = Sentinel('NOTHING'), role_arn: Optional[bool] = Sentinel('NOTHING'), client_request_token: Optional[str] = Sentinel('NOTHING'))[source]

A wrapper provider more user-friendly API and type hint for cloudformation client delete_stack method.

Ref:

aws_cloudformation.better_boto.stacks.wait_delete_stack_to_finish(bsm: boto_session_manager.manager.BotoSesManager, stack_id: str, wait_until_exec_stopped: bool, delays: Union[int, float], timeout: Union[int, float], verbose: bool)[source]

You can run this function after you run delete_stack(). It will wait until the stack deletion success or fail. or timeout.

Parameters
  • bsmboto_session_manager.BotoSesManager object

  • stack_id – the unique stack id, you cannot use stack_name here

  • wait_until_exec_stopped – if False, it will raise an DeleteStackFailedError exception immediately when there is an error and the stack starting to roll back. Note that the stack will take some time to reach stopped status after it failed, you may not to run another deploy immediately. if True, it will raise the exception after the stack reaching stopped status.

  • delays – how long it waits (in seconds) between two “get status” api call

  • timeout – how long it will raise timeout error

  • verbose – whether you want to log information to console

Returns

Nothing

aws_cloudformation.better_boto.stacks.wait_create_or_update_stack_to_finish(bsm: boto_session_manager.manager.BotoSesManager, stack_name: str, wait_until_exec_stopped: bool, delays: Union[int, float], timeout: Union[int, float], verbose: bool) aws_cloudformation.stack.Stack[source]

You can run this function after you run create_stack(), update_stack(), or execute_change_set(). It will wait until the stack status reach success, fail or timeout.

When the stack status reach failed, it will raise DeployStackFailedError immediately. Note that the stack will take some time to reach stopped status after it failed, you may not to run another deploy immediately.

Parameters
  • bsmboto_session_manager.BotoSesManager object

  • stack_name – the stack name or unique stack id

  • wait_until_exec_stopped – if False, it will raise an DeployStackFailedError exception immediately when there is an error and the stack starting to roll back. Note that the stack will take some time to reach stopped status after it failed, you may not to run another deploy immediately. if True, it will raise the exception after the stack reaching stopped status.

  • delays – how long it waits (in seconds) between two “get status” api call

  • timeout – how long it will raise timeout error

  • verbose – whether you want to log information to console

Returns

a Stack object.

aws_cloudformation.better_boto.stacks.wait_create_change_set_to_finish(bsm: boto_session_manager.manager.BotoSesManager, stack_name: str, change_set_id: str, delays: Union[int, float], timeout: Union[int, float], verbose: bool) Optional[aws_cloudformation.stack.ChangeSet][source]

You can run this function after you run create_change_set(). It will wait until the change set creation success, fail, or timeout.

Parameters
  • bsmboto_session_manager.BotoSesManager object

  • stack_name – the stack name or unique stack id

  • change_set_id – the change set id

  • delays – how long it waits (in seconds) between two “get status” api call

  • timeout – how long it will raise timeout error

  • verbose – whether you want to log information to console

Returns

ChangeSet object