run_shell_script#

This module improves the original boto3 SSM client and makes it more pythonic.

aws_ssm_run_command.better_boto.run_shell_script.run_shell_script(ssm_client: SSMClient, commands: Union[str, List[str]], instance_ids: Union[str, List[str]] = Sentinel('NOTHING'), targets: Sequence[TargetTypeDef] = Sentinel('NOTHING'), timeout_seconds: int = Sentinel('NOTHING'), comment: str = Sentinel('NOTHING'), output_s3_bucket_name: str = Sentinel('NOTHING'), output_s3_key_prefix: str = Sentinel('NOTHING'), max_concurrency: str = Sentinel('NOTHING'), max_errors: str = Sentinel('NOTHING'), service_role_arn: str = Sentinel('NOTHING'), notification_config: NotificationConfigTypeDef = Sentinel('NOTHING'), cloudwatch_output_config: CloudWatchOutputConfigTypeDef = Sentinel('NOTHING'), alarm_configuration: AlarmConfigurationTypeDef = Sentinel('NOTHING')) Command[source]#
Parameters:
  • ssm_clientboto3.client("ssm") object

  • commands – the shell script command to run. If you want to run multiple commands, you can pass a list of commands.

  • instance_ids – the EC2 instance where you want to send command. You can pass a single instance id or a list of instance ids.

  • targets – see send_command API reference.

  • timeout_seconds – see send_command API reference.

  • comment – see send_command API reference.

  • output_s3_bucket_name – see send_command API reference.

  • output_s3_key_prefix – see send_command API reference.

  • max_concurrency – see send_command API reference.

  • max_errors – see send_command API reference.

  • service_role_arn – see send_command API reference.

  • notification_config – see send_command API reference.

  • cloudwatch_output_config – see send_command API reference.

  • alarm_configuration – see send_command API reference.

Reference:

aws_ssm_run_command.better_boto.run_shell_script.run_shell_script_async(ssm_client: SSMClient, commands: Union[str, List[str]], instance_ids: Union[str, List[str]] = Sentinel('NOTHING'), targets: Sequence[TargetTypeDef] = Sentinel('NOTHING'), timeout_seconds: int = Sentinel('NOTHING'), comment: str = Sentinel('NOTHING'), output_s3_bucket_name: str = Sentinel('NOTHING'), output_s3_key_prefix: str = Sentinel('NOTHING'), max_concurrency: str = Sentinel('NOTHING'), max_errors: str = Sentinel('NOTHING'), service_role_arn: str = Sentinel('NOTHING'), notification_config: NotificationConfigTypeDef = Sentinel('NOTHING'), cloudwatch_output_config: CloudWatchOutputConfigTypeDef = Sentinel('NOTHING'), alarm_configuration: AlarmConfigurationTypeDef = Sentinel('NOTHING')) Command#
Parameters:
  • ssm_clientboto3.client("ssm") object

  • commands – the shell script command to run. If you want to run multiple commands, you can pass a list of commands.

  • instance_ids – the EC2 instance where you want to send command. You can pass a single instance id or a list of instance ids.

  • targets – see send_command API reference.

  • timeout_seconds – see send_command API reference.

  • comment – see send_command API reference.

  • output_s3_bucket_name – see send_command API reference.

  • output_s3_key_prefix – see send_command API reference.

  • max_concurrency – see send_command API reference.

  • max_errors – see send_command API reference.

  • service_role_arn – see send_command API reference.

  • notification_config – see send_command API reference.

  • cloudwatch_output_config – see send_command API reference.

  • alarm_configuration – see send_command API reference.

Reference:

aws_ssm_run_command.better_boto.run_shell_script.run_shell_script_sync(ssm_client: SSMClient, commands: Union[str, List[str]], instance_ids: Union[str, List[str]] = Sentinel('NOTHING'), targets: Sequence[TargetTypeDef] = Sentinel('NOTHING'), timeout_seconds: int = Sentinel('NOTHING'), comment: str = Sentinel('NOTHING'), output_s3_bucket_name: str = Sentinel('NOTHING'), output_s3_key_prefix: str = Sentinel('NOTHING'), max_concurrency: str = Sentinel('NOTHING'), max_errors: str = Sentinel('NOTHING'), service_role_arn: str = Sentinel('NOTHING'), notification_config: NotificationConfigTypeDef = Sentinel('NOTHING'), cloudwatch_output_config: CloudWatchOutputConfigTypeDef = Sentinel('NOTHING'), alarm_configuration: AlarmConfigurationTypeDef = Sentinel('NOTHING'), allow_fails_config: Union[int, float, str, List[str]] = 0, gap: int = 1, raises: bool = True, delays: int = 3, timeout: int = 60, verbose: bool = True) List[CommandInvocation][source]#

Send command and wait until it succeeds. The original send_command is asynchronous, this function is synchronous.

See send_command() and wait_until_command_succeeded() for input arguments detail.

Parameters:
  • ssm_clientboto3.client("ssm") object

  • commands – the shell script command to run. If you want to run multiple commands, you can pass a list of commands.

  • instance_ids – the EC2 instance where you want to send command. You can pass a single instance id or a list of instance ids.

  • targets – see send_command API reference.

  • timeout_seconds – see send_command API reference.

  • comment – see send_command API reference.

  • output_s3_bucket_name – see send_command API reference.

  • output_s3_key_prefix – see send_command API reference.

  • max_concurrency – see send_command API reference.

  • max_errors – see send_command API reference.

  • service_role_arn – see send_command API reference.

  • notification_config – see send_command API reference.

  • cloudwatch_output_config – see send_command API reference.

  • alarm_configuration – see send_command API reference.

  • allow_fails_config

    how do you want to handle the failed command? if it is 0, then raise exception when any of the instance failed. if it is an integer equal to 1 or greater than 1, then allow that many instance to fail. if it is a float between 0 and 1 (cannot be 0.0 or 1.0), then allow that percentage of instance to fail. if it is a str or list of str, then allow the provided instance id to fail. To allow all instances to fail, you can pass the value of instance_ids

    to it.

  • gap – the gap between each send_command api and the first get_command_invocation api call. Because it takes some time to have the command invocation fired to SSM agent.

  • raises – if True, raises exception when the command invocation failed.

  • delays – how many seconds to wait between each get_command_invocation

  • timeout – how many seconds to wait until the command invocation is succeeded.

  • verbose – do you want to print the waiting message?