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_client –
boto3.client("ssm")objectcommands – 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_commandAPI reference.timeout_seconds – see
send_commandAPI reference.comment – see
send_commandAPI reference.output_s3_bucket_name – see
send_commandAPI reference.output_s3_key_prefix – see
send_commandAPI reference.max_concurrency – see
send_commandAPI reference.max_errors – see
send_commandAPI reference.service_role_arn – see
send_commandAPI reference.notification_config – see
send_commandAPI reference.cloudwatch_output_config – see
send_commandAPI reference.alarm_configuration – see
send_commandAPI 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_client –
boto3.client("ssm")objectcommands – 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_commandAPI reference.timeout_seconds – see
send_commandAPI reference.comment – see
send_commandAPI reference.output_s3_bucket_name – see
send_commandAPI reference.output_s3_key_prefix – see
send_commandAPI reference.max_concurrency – see
send_commandAPI reference.max_errors – see
send_commandAPI reference.service_role_arn – see
send_commandAPI reference.notification_config – see
send_commandAPI reference.cloudwatch_output_config – see
send_commandAPI reference.alarm_configuration – see
send_commandAPI 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()andwait_until_command_succeeded()for input arguments detail.- Parameters:
ssm_client –
boto3.client("ssm")objectcommands – 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_commandAPI reference.timeout_seconds – see
send_commandAPI reference.comment – see
send_commandAPI reference.output_s3_bucket_name – see
send_commandAPI reference.output_s3_key_prefix – see
send_commandAPI reference.max_concurrency – see
send_commandAPI reference.max_errors – see
send_commandAPI reference.service_role_arn – see
send_commandAPI reference.notification_config – see
send_commandAPI reference.cloudwatch_output_config – see
send_commandAPI reference.alarm_configuration – see
send_commandAPI 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_idsto it.
gap – the gap between each
send_commandapi and the firstget_command_invocationapi 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_invocationtimeout – how many seconds to wait until the command invocation is succeeded.
verbose – do you want to print the waiting message?