ModifyVpcPeeringConnectionOptions - Amazon Elastic Compute Cloud
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

ModifyVpcPeeringConnectionOptions

Note

We are retiring EC2-Classic. We recommend that you migrate from EC2-Classic to a VPC. For more information, see Migrate from EC2-Classic to a VPC in the Amazon Elastic Compute Cloud User Guide.

Modifies the VPC peering connection options on one side of a VPC peering connection. You can do the following:

  • Enable/disable communication over the peering connection between an EC2-Classic instance that's linked to your VPC (using ClassicLink) and instances in the peer VPC.

  • Enable/disable communication over the peering connection between instances in your VPC and an EC2-Classic instance that's linked to the peer VPC.

  • Enable/disable the ability to resolve public DNS hostnames to private IP addresses when queried from instances in the peer VPC.

If the peered VPCs are in the same Amazon Web Services account, you can enable DNS resolution for queries from the local VPC. This ensures that queries from the local VPC resolve to private IP addresses in the peer VPC. This option is not available if the peered VPCs are in different Amazon Web Services accounts or different Regions. For peered VPCs in different Amazon Web Services accounts, each Amazon Web Services account owner must initiate a separate request to modify the peering connection options. For inter-region peering connections, you must use the Region for the requester VPC to modify the requester VPC peering options and the Region for the accepter VPC to modify the accepter VPC peering options. To verify which VPCs are the accepter and the requester for a VPC peering connection, use the DescribeVpcPeeringConnections command.

Request Parameters

The following parameters are for this specific action. For more information about required and optional parameters that are common to all actions, see Common Query Parameters.

AccepterPeeringConnectionOptions

The VPC peering connection options for the accepter VPC.

Type: PeeringConnectionOptionsRequest object

Required: No

DryRun

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.

Type: Boolean

Required: No

RequesterPeeringConnectionOptions

The VPC peering connection options for the requester VPC.

Type: PeeringConnectionOptionsRequest object

Required: No

VpcPeeringConnectionId

The ID of the VPC peering connection.

Type: String

Required: Yes

Response Elements

The following elements are returned by the service.

accepterPeeringConnectionOptions

Information about the VPC peering connection options for the accepter VPC.

Type: PeeringConnectionOptions object

requesterPeeringConnectionOptions

Information about the VPC peering connection options for the requester VPC.

Type: PeeringConnectionOptions object

requestId

The ID of the request.

Type: String

Errors

For information about the errors that are common to all actions, see Common client error codes.

Examples

Example

In this example, you have an EC2-Classic instance linked to your VPC. You want to enable communication over the VPC peering connection to allow the linked EC2-Classic instance to communicate with instances in the peer VPC. You were the requester of the VPC peering connection, therefore you modify the requester VPC peering connection options.

Sample Request

https://ec2.amazonaws.com/?Action=ModifyVpcPeeringConnectionOptions &VpcPeeringConnectionId=pcx-1a2b3c4d &RequesterPeeringConnectionOptions.AllowEgressFromLocalClassicLinkToRemoteVpc=true &AUTHPARAMS

Sample Response

<ModifyVpcPeeringConnectionOptionsResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"> <requestId>8d977c82-8aba-4cd1-81ca-example</requestId> <requesterPeeringConnectionOptions> <allowEgressFromLocalClassicLinkToRemoteVpc>true</allowEgressFromLocalClassicLinkToRemoteVpc> </requesterPeeringConnectionOptions> </ModifyVpcPeeringConnectionOptionsResponse>

Example

In this example, you want to enable communication from instances in your local VPC to any linked EC2-Classic instances in the peer VPC. You were the accepter of the VPC peering connection, therefore you modify the accepter VPC peering connection options.

Sample Request

https://ec2.amazonaws.com/?Action=ModifyVpcPeeringConnectionOptions &VpcPeeringConnectionId=pcx-1a2b3c4d &AccepterPeeringConnectionOptions.AllowEgressFromLocalVpcToRemoteClassicLink=true &AUTHPARAMS

Sample Response

<ModifyVpcPeeringConnectionOptionsResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"> <requestId>f5131846-7920-4359-b565-example</requestId> <accepterPeeringConnectionOptions> <allowEgressFromLocalVpcToRemoteClassicLink>true</allowEgressFromLocalVpcToRemoteClassicLink> </accepterPeeringConnectionOptions> </ModifyVpcPeeringConnectionOptionsResponse>

Example

In this example, you want the public DNS hostnames of your instances in your VPC to resolve to private IP addresses when queried from instances in the peer VPC. You were the accepter of the VPC peering connection, therefore you modify the accepter VPC peering connection options.

Sample Request

https://ec2.amazonaws.com/?Action=ModifyVpcPeeringConnectionOptions &VpcPeeringConnectionId=pcx-1a2b3c4d &AccepterPeeringConnectionOptions.AllowDnsResolutionFromRemoteVpc=true &AUTHPARAMS

Sample Response

<ModifyVpcPeeringConnectionOptionsResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"> <requestId>f5131846-7920-4359-b565-example</requestId> <accepterPeeringConnectionOptions> <allowDnsResolutionFromRemoteVpc>true</allowDnsResolutionFromRemoteVpc> </accepterPeeringConnectionOptions> </ModifyVpcPeeringConnectionOptionsResponse>

See Also

For more information about using this API in one of the language-specific Amazon SDKs, see the following: