CreateVpcPeeringConnection

Establishes a VPC peering connection between a virtual private cloud (VPC) in an AWS
account with the VPC
for your Amazon GameLift fleet. VPC peering enables the game servers on your fleet
to
communicate directly with other AWS resources. You can peer with VPCs in any AWS account
that you have access to, including the account that you use to manage your Amazon
GameLift
fleets. You cannot peer with VPCs that are in different regions. For more information,
see VPC Peering with Amazon GameLift Fleets.

Before calling this operation to establish the peering connection, you first need
to call CreateVpcPeeringAuthorization and identify the VPC you want to
peer with. Once the authorization for the specified VPC is issued, you have 24 hours
to
establish the connection. These two operations handle all tasks necessary to peer
the
two VPCs, including acceptance, updating routing tables, etc.

To establish the connection, call this operation from the AWS account that is used
to manage the Amazon GameLift fleets. Identify the following values: (1) The ID of
the fleet
you want to be enable a VPC peering connection for; (2) The AWS account with the VPC
that you want to peer with; and (3) The ID of the VPC you want to peer with. This
operation is asynchronous. If successful, a VpcPeeringConnection
request is created. You can use continuous polling to track the request's status using
DescribeVpcPeeringConnections, or by monitoring fleet events for
success or failure using DescribeFleetEvents.

Unique identifier for a VPC with resources to be accessed by your Amazon GameLift
fleet. The
VPC must be in the same region where your fleet is deployed. Look up a VPC ID using
the
VPC Dashboard in the AWS Management Console.
Learn more about VPC peering in VPC Peering with Amazon GameLift Fleets.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: Yes

Response Elements

If the action is successful, the service sends back an HTTP 200 response with an empty
HTTP body.

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalServiceException

The service encountered an unrecoverable internal failure while processing the
request. Clients can retry such requests immediately or after a waiting
period.

HTTP Status Code: 500

InvalidRequestException

One or more parameter values in the request are invalid. Correct the invalid
parameter values before retrying.

HTTP Status Code: 400

NotFoundException

A service resource associated with the request could not be found. Clients should
not retry such requests.

HTTP Status Code: 400

UnauthorizedException

The client failed authentication. Clients should not retry such requests.

HTTP Status Code: 400

Examples

This example builds on Example 1 in CreateVpcPeeringAuthorization. If authorization succeeded, the next
step is to tell Amazon GameLift to request the peering connection. In this example,
you want your game servers that are running on an Amazon GameLift fleet to be able
to
access a web service. The web service is managed through the same AWS account
that you use to manage your Amazon GameLift fleet. To request the peering, provide
the
following details for the two VPCs to peer: (1) the Amazon GameLift fleet ID, and
(2)
the account and VPC for the web service. The account ID and VPC for the web
service must be the same one you used in the authorization.

The fleet's ID is
fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa. The AWS
account (the same as the one you use to manage your Amazon GameLift fleet) is
111122223333. The VPC ID for the web service is
vpc-a12bc345.

To make this request, sign in using your credentials for AWS account
111122223333. To view the resulting new connection record, call DescribeVpcPeeringConnections with the fleet ID.

Peer the VPC for your Amazon GameLift fleet with a VPC on a different AWS account

This example builds on Example 2 in CreateVpcPeeringAuthorization. If authorization succeeded, the next
step is to tell Amazon GameLift to request the peering connection. As in the previous
example, you want your game servers that are running on an Amazon GameLift fleet to
be
able to access a web service. But in this example, the web service is managed by
a different account from the one that you use to manage your Amazon GameLift fleet.
To
request the peering, provide the following details for the two VPCs to peer: (1)
the Amazon GameLift fleet ID, and (2) the account and VPC for the web service. The
account ID and VPC for the web service must be the same one you used in the
authorization.

The fleet's ID is
fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa. Your
Amazon GameLift account ID is 111122223333. The AWS account with
the web service is 444455556666. The VPC ID for the web
service is vpc-c67ef890.

To make this request, sign in using your credentials for AWS account
111122223333 (your Amazon GameLift account). To view resulting new connection record,
call DescribeVpcPeeringConnections with the fleet
ID.