deploy

Implement the fancy deployment and remove API with “terraform plan” liked feature.

aws_cloudformation.deploy.prompt_to_proceed() bool[source]

Prompt to ask user to enter: “YES” or “NO”

Returns

True if user entered YES, otherwise returns False.

class aws_cloudformation.deploy.DeployStackResponse(is_deploy_happened: bool = False, is_create: Union[bool, NoneType] = None, stack_id: Union[str, NoneType] = None, change_set_id: Union[str, NoneType] = None)[source]
aws_cloudformation.deploy.deploy_stack(bsm: boto_session_manager.manager.BotoSesManager, stack_name: str, template: Optional[str] = Sentinel('NOTHING'), use_previous_template: Optional[bool] = Sentinel('NOTHING'), bucket: Optional[str] = Sentinel('NOTHING'), prefix: Optional[str] = 'cloudformation/template', parameters: Optional[List[aws_cloudformation.stack.Parameter]] = Sentinel('NOTHING'), tags: Optional[Dict[str, str]] = Sentinel('NOTHING'), execution_role_arn: Optional[str] = Sentinel('NOTHING'), include_iam: Optional[bool] = Sentinel('NOTHING'), include_named_iam: Optional[bool] = Sentinel('NOTHING'), include_macro: Optional[bool] = Sentinel('NOTHING'), stack_policy: Optional[str] = Sentinel('NOTHING'), prefix_stack_policy: Optional[str] = 'cloudformation/policy', resource_types: Optional[List[str]] = Sentinel('NOTHING'), client_request_token: Optional[str] = Sentinel('NOTHING'), enable_termination_protection: Optional[bool] = Sentinel('NOTHING'), disable_rollback: Optional[bool] = Sentinel('NOTHING'), rollback_configuration: Optional[dict] = Sentinel('NOTHING'), notification_arns: Optional[List[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'), wait: bool = True, delays: Union[int, float] = 5, timeout: Union[int, float] = 120, wait_until_exec_stopped_on_failure: bool = False, plan_nested_stack: bool = True, skip_plan: bool = False, skip_prompt: bool = False, change_set_delays: Union[int, float] = 5, change_set_timeout: Union[int, float] = 120, verbose: bool = True) aws_cloudformation.deploy.DeployStackResponse[source]

Deploy (create or update) an AWS CloudFormation stack. But more powerful than the original boto3 API.

Deploy Stack related boto3 API:

Parameters
  • bsmboto_session_manager.BotoSesManager object

  • stack_name – the stack name or unique stack id

  • template – CloudFormation template JSON or Yaml body in text, or the s3 uri pointing to a CloudFormation template file.

  • use_previous_template – see “Deploy Stack related boto3 API” link

  • bucket – default None; if given, automatically upload template to S3 before deployment. see upload_template_to_s3() for more details.

  • prefix – the s3 prefix where you want to upload the template to

  • parameters – list of aws_cloudformation.stack.Parameter object

  • tags – key value dictionary for tags

  • execution_role_arn – see “Deploy Stack related boto3 API” link

  • include_iam – see “Capacities” part in “Deploy Stack related boto3 API” link

  • include_named_iam – see “Capacities” part in “Deploy Stack related boto3 API” link

  • include_macro – see “Capacities” part in “Deploy Stack related boto3 API” link

  • stack_policy – Stack Policy JSON or Yaml body in text, or the s3 uri pointing to a Stack Policy JSON template file.

  • prefix_stack_policy – see “Deploy Stack related boto3 API” link

  • resource_types – see “Deploy Stack related boto3 API” link

  • client_request_token – see “Deploy Stack related boto3 API” link

  • enable_termination_protection – see “Create Stack Boto3 API” link

  • disable_rollback – see “Create Stack Boto3 API” link

  • rollback_configuration – see “Create Stack Boto3 API” link

  • notification_arns – see “Create Stack Boto3 API” link

  • on_failure_do_nothing – only used when you create stack directly, not using change set. If you set skip_plan = True, then this parameter will be ignored.

  • on_failure_rollback – only used when you create stack directly, not using change set.only used when you create stack directly, not using change set. If you set skip_plan = True, then this parameter will be ignored.

  • on_failure_delete – only used when you create stack directly, not using change set. If you set skip_plan = True, then this parameter will be ignored.

  • wait – default True; if True, then wait the create / update action to success or fail; if False, then it is an async call and return immediately; note that if you have skip_plan is False (using change set), you always have to wait the change set creation to finish.

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

  • timeout – how long it will raise timeout error

  • wait_until_exec_stopped_on_failure – 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.

  • plan_nested_stack – do you want to plan change set for nested stack?

  • skip_plan – default False; if False, force to use change set to create / update; if True, then do create / update without change set.

  • skip_prompt – default False; if False, you have to enter “Yes” in prompt to do deployment; if True, then execute the deployment directly.

  • change_set_delays – how long it waits (in seconds) between two “describe_change_set” api call to get the change set status

  • change_set_timeout – how long it will raise timeout error

  • verbose – whether you want to log information to console

Returns

Nothing

New in version 0.1.1.

aws_cloudformation.deploy.remove_stack(bsm: boto_session_manager.manager.BotoSesManager, stack_name: str, retain_resources: Optional[List[str]] = Sentinel('NOTHING'), role_arn: Optional[str] = Sentinel('NOTHING'), client_request_token: Optional[str] = Sentinel('NOTHING'), wait: bool = True, delays: Union[int, float] = 5, timeout: Union[int, float] = 120, wait_until_exec_stopped_on_failure: bool = False, skip_prompt: bool = False, verbose: bool = True)[source]

Remove an AWS CloudFormation Stack.

Reference:

Parameters
  • bsmboto_session_manager.BotoSesManager object

  • stack_name – the stack name or unique stack id

  • retain_resources – see “Delete Stack Boto3 API” link

  • role_arn – see “Delete Stack Boto3 API” link

  • client_request_token – see “Delete Stack Boto3 API” link

  • wait – default True; if True, then wait the delete action to success or fail; if False, then it is an async call and return immediately.

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

  • timeout – how long it will raise timeout error

  • wait_until_exec_stopped_on_failure – 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.

  • skip_prompt – default False; if False, you have to enter “Yes” in prompt to do deletion; if True, then execute the deletion directly.

  • verbose – whether you want to log information to console

Returns

None

New in version 0.1.1.

aws_cloudformation.deploy.deploy_stack_set(bsm: boto_session_manager.manager.BotoSesManager, stack_set_name: str, template: Optional[str] = Sentinel('NOTHING'), use_previous_template: Optional[bool] = Sentinel('NOTHING'), bucket: Optional[str] = Sentinel('NOTHING'), prefix: Optional[str] = 'cloudformation/template', description: Optional[str] = Sentinel('NOTHING'), stack_id: Optional[str] = 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'), tags: Optional[Dict[str, str]] = Sentinel('NOTHING'), operation_preferences: Optional[dict] = Sentinel('NOTHING'), admin_role_arn: Optional[str] = Sentinel('NOTHING'), execution_role_name: Optional[str] = Sentinel('NOTHING'), deployment_target: Optional[dict] = Sentinel('NOTHING'), permission_model_is_self_managed: Optional[bool] = Sentinel('NOTHING'), permission_model_is_service_managed: Optional[bool] = Sentinel('NOTHING'), auto_deployment_is_enabled: Optional[bool] = Sentinel('NOTHING'), auto_deployment_retain_stacks_on_account_removal: Optional[bool] = Sentinel('NOTHING'), operation_id: Optional[str] = Sentinel('NOTHING'), accounts: Optional[List[str]] = Sentinel('NOTHING'), regions: Optional[List[str]] = Sentinel('NOTHING'), call_as_self: Optional[bool] = Sentinel('NOTHING'), call_as_delegated_admin: Optional[bool] = Sentinel('NOTHING'), client_request_token: Optional[str] = Sentinel('NOTHING'), managed_execution_active: Optional[bool] = Sentinel('NOTHING'), verbose: bool = True) Tuple[bool, str][source]

Deploy (create or update) an AWS CloudFormation stack set. But more powerful than the original boto3 API.

Deploy StackSet related boto3 API:

Parameters
  • bsmboto_session_manager.BotoSesManager object

  • stack_set_name – the stack set name

  • template – CloudFormation template JSON or Yaml body in text, or the s3 uri pointing to a CloudFormation template file.

  • use_previous_template

  • bucket – default None; if given, automatically upload template to S3 before deployment. see upload_template_to_s3() for more details.

  • prefix – the s3 prefix where you want to upload the template to

  • description – stack set description

  • stack_id – the stack id you want to import

  • parameters – list of aws_cloudformation.stack.Parameter object

  • include_iam – see “Capacities” part in “Deploy Stack related boto3 API” link

  • include_named_iam – see “Capacities” part in “Deploy Stack related boto3 API” link

  • include_macro – see “Capacities” part in “Deploy Stack related boto3 API” link

  • tags – key value dictionary for tags

  • operation_preferences – see “Deploy StackSet related boto3 API” link

  • admin_role_arn – see “Deploy StackSet related boto3 API” link

  • execution_role_arn – see “Deploy StackSet related boto3 API” link

  • deployment_target – see “Deploy StackSet related boto3 API” link

  • permission_model_is_self_managed – see “Deploy StackSet related boto3 API” link

  • permission_model_is_service_managed – see “Deploy StackSet related boto3 API” link

  • auto_deployment_is_enabled – see “Deploy StackSet related boto3 API” link

  • auto_deployment_retain_stacks_on_account_removal – see “Deploy StackSet related boto3 API” link

  • operation_id – see “Deploy StackSet related boto3 API” link

  • accounts – see “Deploy StackSet related boto3 API” link

  • regions – see “Deploy StackSet related boto3 API” link

  • call_as_self – see “Deploy StackSet related boto3 API” link

  • call_as_delegated_admin – see “Deploy StackSet related boto3 API” link

  • client_request_token – see “Deploy StackSet related boto3 API” link

  • managed_execution_active – see “Deploy StackSet related boto3 API” link

  • verbose – whether you want to log information to console

Returns

(is_create, stack_set_id_or_operation_id)

aws_cloudformation.deploy.remove_stack_set(bsm: boto_session_manager.manager.BotoSesManager, stack_set_name: str, call_as_self: Optional[bool] = Sentinel('NOTHING'), call_as_delegated_admin: Optional[bool] = Sentinel('NOTHING'), verbose: bool = True)[source]

Remove an AWS CloudFormation stack set.

Delete StackSet related boto3 API:

Parameters
  • bsmboto_session_manager.BotoSesManager object

  • stack_set_name – the stack set name

  • call_as_self – see “Delete StackSet related boto3 API” link

  • call_as_delegated_admin – see “Delete StackSet related boto3 API” link

  • verbose – whether you want to log information to console

Returns

None