You are viewing documentation for version 1 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: AWS::EC2::VPCPeeringConnectionCollection

Inherits:
Collection
  • Object
show all
Includes:
Core::Collection::Simple, TaggedCollection
Defined in:
lib/aws/ec2/vpc_peering_connection_collection.rb

Instance Method Summary collapse

Methods included from Core::Collection

#each, #each_batch, #enum, #first, #in_groups_of, #page

Methods included from TaggedCollection

#tagged, #tagged_values, #with_tag

Methods included from FilteredCollection

#filter, #initialize

Instance Method Details

#[](vpc_peering_connection_id) ⇒ VPCPeeringConnection

Returns a reference to the VPC peering connection with the given id.

vpc_peering_connection = vpc.peering_connections['vpc-peering-connection-id']

Parameters:

  • vpc_peering_connection_id (String)

Returns:



38
39
40
# File 'lib/aws/ec2/vpc_peering_connection_collection.rb', line 38

def [] vpc_peering_connection_id
  VPCPeeringConnection.new(vpc_peering_connection_id, :config => config)
end

#create(local_vpc, remote_vpc, options = {}) ⇒ Object

Requests a new VPC peering connection between the "local" VPC and the "remote" VPC



21
22
23
24
25
26
27
28
# File 'lib/aws/ec2/vpc_peering_connection_collection.rb', line 21

def create local_vpc, remote_vpc, options = {}
  client_opts = {}
  client_opts[:vpc_id] = local_vpc.id
  client_opts[:peer_vpc_id] = remote_vpc.id
  
  resp = client.create_vpc_peering_connection(client_opts)
  VPCPeeringConnection.new_from(:create_vpc_peering_connection, resp.vpc_peering_connection, resp.vpc_peering_connection.vpc_peering_connection_id, :config => config)
end