Modifies the recovery behavior of your instance to disable simplified automatic recovery or set the recovery behavior to default. The default configuration will not enable simplified automatic recovery for an unsupported instance type. For more information, see Simplified automatic recovery.
Modifies the reboot migration behavior during a user-initiated reboot of an instance that has a pending system-reboot event. For more information, see Enable or disable reboot migration.
Parameters:
-
instance_id
(Optional[InstanceId], default:
None
)
–
-
auto_recovery
(Optional[InstanceAutoRecoveryState], default:
None
)
–
Disables the automatic recovery behavior of your instance or sets it to default.
-
reboot_migration
(Optional[InstanceRebootMigrationState], default:
None
)
–
Specifies whether to attempt reboot migration during a user-initiated reboot of an instance that has a scheduled system-reboot event:
-
default - Amazon EC2 attempts to migrate the instance to new hardware (reboot migration). If successful, the system-reboot event is cleared. If unsuccessful, an in-place reboot occurs and the event remains scheduled.
-
disabled - Amazon EC2 keeps the instance on the same hardware (in-place reboot). The system-reboot event remains scheduled.
This setting only applies to supported instances that have a scheduled reboot event. For more information, see Enable or disable reboot migration in the Amazon EC2 User Guide.
-
dry_run
(Optional[Boolean], default:
None
)
–
Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.
Raises:
Source code in docs_src/capo_ec2/_services/ec2.py
| def modify_instance_maintenance_options(
self,
*,
config_overrides: Optional[EC2ClientConfig] = None,
instance_id: Optional["capo_ec2.types.instance_id.InstanceId"] = None,
auto_recovery: Optional[
"capo_ec2.types.instance_auto_recovery_state.InstanceAutoRecoveryState"
] = None,
reboot_migration: Optional[
"capo_ec2.types.instance_reboot_migration_state.InstanceRebootMigrationState"
] = None,
dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.modify_instance_maintenance_options_result.ModifyInstanceMaintenanceOptionsResult":
"""<p>Modifies the recovery behavior of your instance to disable simplified automatic recovery or set the recovery behavior to default. The default configuration will not enable simplified automatic recovery for an unsupported instance type. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-recover.html#instance-configuration-recovery">Simplified automatic recovery</a>.</p> <p>Modifies the reboot migration behavior during a user-initiated reboot of an instance that has a pending <code>system-reboot</code> event. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/schedevents_actions_reboot.html#reboot-migration">Enable or disable reboot migration</a>.</p>
Args:
instance_id: <p>The ID of the instance.</p>
auto_recovery: <p>Disables the automatic recovery behavior of your instance or sets it to default.</p>
reboot_migration: <p>Specifies whether to attempt reboot migration during a user-initiated reboot of an instance that has a scheduled <code>system-reboot</code> event:</p> <ul> <li> <p> <code>default</code> - Amazon EC2 attempts to migrate the instance to new hardware (reboot migration). If successful, the <code>system-reboot</code> event is cleared. If unsuccessful, an in-place reboot occurs and the event remains scheduled.</p> </li> <li> <p> <code>disabled</code> - Amazon EC2 keeps the instance on the same hardware (in-place reboot). The <code>system-reboot</code> event remains scheduled.</p> </li> </ul> <p>This setting only applies to supported instances that have a scheduled reboot event. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/schedevents_actions_reboot.html#reboot-migration">Enable or disable reboot migration</a> in the <i>Amazon EC2 User Guide</i>.</p>
dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
Raises:
capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_ec2.types.modify_instance_maintenance_options_request.ModifyInstanceMaintenanceOptionsRequest]",
) -> OperationResponse[
"capo_ec2.types.modify_instance_maintenance_options_result.ModifyInstanceMaintenanceOptionsResult"
]:
import capo_ec2._operations.amazon_ec2.modify_instance_maintenance_options
output, http_response = (
capo_ec2._operations.amazon_ec2.modify_instance_maintenance_options.modify_instance_maintenance_options(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("ModifyInstanceMaintenanceOptions")
)
input_: capo_ec2.types.modify_instance_maintenance_options_request.ModifyInstanceMaintenanceOptionsRequest = {}
if instance_id is not None:
input_["instance_id"] = instance_id
if auto_recovery is not None:
input_["auto_recovery"] = auto_recovery
if reboot_migration is not None:
input_["reboot_migration"] = reboot_migration
if dry_run is not None:
input_["dry_run"] = dry_run
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|