2015-02-12 10:45:29 +01:00
---
layout: "aws"
page_title: "AWS: aws_vpc_peering_connection"
2015-05-08 11:31:22 +02:00
sidebar_current: "docs-aws-resource-vpc-peering"
2015-02-12 10:45:29 +01:00
description: |-
Provides an VPC Peering Connection resource.
---
# aws\_vpc\_peering\_connection
Provides an VPC Peering Connection resource.
## Example Usage
Basic usage:
```
2016-06-09 21:48:03 +02:00
resource "aws_vpc_peering_connection" "foo" {
peer_owner_id = "${var.peer_owner_id}"
peer_vpc_id = "${aws_vpc.bar.id}"
vpc_id = "${aws_vpc.foo.id}"
2015-02-12 10:45:29 +01:00
}
```
Basic usage with tags:
```
resource "aws_vpc_peering_connection" "foo" {
peer_owner_id = "${var.peer_owner_id}"
peer_vpc_id = "${aws_vpc.bar.id}"
vpc_id = "${aws_vpc.foo.id}"
2016-06-09 21:48:03 +02:00
auto_accept = true
tags {
Name = "VPC Peering between foo and bar"
}
2015-02-12 10:45:29 +01:00
}
resource "aws_vpc" "foo" {
cidr_block = "10.1.0.0/16"
}
resource "aws_vpc" "bar" {
cidr_block = "10.2.0.0/16"
}
```
## Argument Reference
The following arguments are supported:
* `peer_owner_id` - (Required) The AWS account ID of the owner of the peer VPC.
* `peer_vpc_id` - (Required) The ID of the VPC with which you are creating the VPC peering connection.
* `vpc_id` - (Required) The ID of the requester VPC.
2015-05-28 20:32:26 +02:00
* `auto_accept` - (Optional) Accept the peering (you need to be the owner of both VPCs).
2015-02-12 10:45:29 +01:00
* `tags` - (Optional) A mapping of tags to assign to the resource.
## Attributes Reference
The following attributes are exported:
2015-05-28 22:53:05 +02:00
* `id` - The ID of the VPC Peering Connections
2015-03-09 09:59:52 +01:00
* `accept_status` - The Status of the VPC peering connection request.
2015-02-18 10:45:12 +01:00
## Notes
2016-06-09 21:48:03 +02:00
If you are not the owner of both VPCs, or do not enable auto_accept you will still have to accept the peering with the AWS Console, aws-cli or aws-sdk-go.
2016-07-19 18:22:30 +02:00
## Import
VPC Peering resources can be imported using the `vpc peering id` , e.g.
```
2016-07-21 00:28:59 +02:00
$ terraform import aws_vpc_peering_connection.test_connection pcx-111aaa111
2016-07-19 18:22:30 +02:00
```