Menu
Amazon Elastic Compute Cloud
API Reference (API Version 2016-11-15)

ModifyVpcPeeringConnectionOptions

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 a local VPC to resolve public DNS hostnames to private IP addresses when queried from instances in the peer VPC.

If the peered VPCs are in different accounts, each owner must initiate a separate request to modify the peering connection options, depending on whether their VPC was the requester or accepter for the VPC peering connection. If the peered VPCs are in the same account, you can modify the requester and accepter options in the same request. To confirm which VPC is the accepter and 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 operation, 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 Errors.

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 to enable your VPC to resolve public DNS hostname 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 AWS SDKs, see the following: