This action is deprecated.
Links an EC2-Classic instance to a ClassicLink-enabled VPC through one or more of the VPC security groups. You cannot link an EC2-Classic instance to more than one VPC at a time. You can only link an instance that's in the running state. An instance is automatically unlinked from a VPC when it's stopped - you can link it to the VPC again when you restart it.
After you've linked an instance, you cannot change the VPC security groups that are associated with it. To change the security groups, you must first unlink the instance, and then link it again.
Linking your instance to a VPC is sometimes referred to as attaching your instance.
Parameters:
-
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.
-
instance_id
(Optional[InstanceId], default:
None
)
–
The ID of the EC2-Classic instance.
-
vpc_id
(Optional[VpcId], default:
None
)
–
The ID of the ClassicLink-enabled VPC.
-
groups
(Optional[GroupIdStringList], default:
None
)
–
The IDs of the security groups. You cannot specify security groups from a different VPC.
Raises:
Source code in docs_src/capo_ec2/_services/async_ec2.py
| async def attach_classic_link_vpc(
self,
*,
config_overrides: Optional[AsyncEC2ClientConfig] = None,
dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
instance_id: Optional["capo_ec2.types.instance_id.InstanceId"] = None,
vpc_id: Optional["capo_ec2.types.vpc_id.VpcId"] = None,
groups: Optional[
"capo_ec2.types.group_id_string_list.GroupIdStringList"
] = None,
) -> "capo_ec2.types.attach_classic_link_vpc_result.AttachClassicLinkVpcResult":
"""<note> <p>This action is deprecated.</p> </note> <p>Links an EC2-Classic instance to a ClassicLink-enabled VPC through one or more of the VPC security groups. You cannot link an EC2-Classic instance to more than one VPC at a time. You can only link an instance that's in the <code>running</code> state. An instance is automatically unlinked from a VPC when it's stopped - you can link it to the VPC again when you restart it.</p> <p>After you've linked an instance, you cannot change the VPC security groups that are associated with it. To change the security groups, you must first unlink the instance, and then link it again.</p> <p>Linking your instance to a VPC is sometimes referred to as <i>attaching</i> your instance.</p>
Args:
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>
instance_id: <p>The ID of the EC2-Classic instance.</p>
vpc_id: <p>The ID of the ClassicLink-enabled VPC.</p>
groups: <p>The IDs of the security groups. You cannot specify security groups from a different VPC.</p>
Raises:
capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_ec2.types.attach_classic_link_vpc_request.AttachClassicLinkVpcRequest]",
) -> AsyncOperationResponse[
"capo_ec2.types.attach_classic_link_vpc_result.AttachClassicLinkVpcResult"
]:
import capo_ec2._operations.amazon_ec2.attach_classic_link_vpc
(
output,
http_response,
) = await capo_ec2._operations.amazon_ec2.attach_classic_link_vpc.async_attach_classic_link_vpc(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("AttachClassicLinkVpc")
)
input_: capo_ec2.types.attach_classic_link_vpc_request.AttachClassicLinkVpcRequest = {}
if dry_run is not None:
input_["dry_run"] = dry_run
if instance_id is not None:
input_["instance_id"] = instance_id
if vpc_id is not None:
input_["vpc_id"] = vpc_id
if groups is not None:
input_["groups"] = groups
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|