Method: Fog::Compute::AWS::Real#create_subnet

Defined in:
lib/fog/aws/requests/compute/create_subnet.rb

#create_subnet(vpcId, cidrBlock, options = {}) ⇒ Object

Creates a Subnet with the CIDR block you specify.

Parameters

  • vpcId<~String> - The ID of the VPC where you want to create the subnet.

  • cidrBlock<~String> - The CIDR block you want the Subnet to cover (e.g., 10.0.0.0/16).

  • options<~Hash>:

    • AvailabilityZone<~String> - The Availability Zone you want the subnet in. Default: AWS selects a zone for you (recommended)

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

  • ‘requestId’<~String> - Id of request

  • ‘subnet’<~Array>:

  • ‘subnetId’<~String> - The Subnet’s ID

  • ‘state’<~String> - The current state of the Subnet. [‘pending’, ‘available’]

  • ‘cidrBlock’<~String> - The CIDR block the Subnet covers.

  • ‘AvailableIpAddressCount’<~Integer> - The number of unused IP addresses in the subnet (the IP addresses for any stopped instances are considered unavailable)

  • ‘AvailabilityZone’<~String> - The Availability Zone the subnet is in

  • ‘tagSet’<~Array>: Tags assigned to the resource.

  • ‘key’<~String> - Tag’s key

  • ‘value’<~String> - Tag’s value

Amazon API Reference

[View source]

32
33
34
35
36
37
38
39
40
# File 'lib/fog/aws/requests/compute/create_subnet.rb', line 32

def create_subnet(vpcId, cidrBlock, options = {})
  request({
    'Action'     => 'CreateSubnet',
    'VpcId'      => vpcId,
    'CidrBlock'  => cidrBlock,
    :parser      => Fog::Parsers::Compute::AWS::CreateSubnet.new
  }.merge!(options))

end