Class: Fog::AWS::Compute::Real

Inherits:
Object
  • Object
show all
Includes:
Fog::AWS::CredentialFetcher::ConnectionMethods
Defined in:
lib/fog/aws/compute.rb,
lib/fog/aws/compute.rb,
lib/fog/aws/requests/compute/copy_image.rb,
lib/fog/aws/requests/compute/create_vpc.rb,
lib/fog/aws/requests/compute/delete_vpc.rb,
lib/fog/aws/requests/compute/create_tags.rb,
lib/fog/aws/requests/compute/delete_tags.rb,
lib/fog/aws/requests/compute/create_image.rb,
lib/fog/aws/requests/compute/create_route.rb,
lib/fog/aws/requests/compute/delete_route.rb,
lib/fog/aws/requests/compute/attach_volume.rb,
lib/fog/aws/requests/compute/copy_snapshot.rb,
lib/fog/aws/requests/compute/create_subnet.rb,
lib/fog/aws/requests/compute/create_volume.rb,
lib/fog/aws/requests/compute/delete_subnet.rb,
lib/fog/aws/requests/compute/delete_volume.rb,
lib/fog/aws/requests/compute/describe_tags.rb,
lib/fog/aws/requests/compute/describe_vpcs.rb,
lib/fog/aws/requests/compute/detach_volume.rb,
lib/fog/aws/requests/compute/modify_volume.rb,
lib/fog/aws/requests/compute/replace_route.rb,
lib/fog/aws/requests/compute/run_instances.rb,
lib/fog/aws/requests/compute/register_image.rb,
lib/fog/aws/requests/compute/stop_instances.rb,
lib/fog/aws/requests/compute/create_key_pair.rb,
lib/fog/aws/requests/compute/create_snapshot.rb,
lib/fog/aws/requests/compute/delete_key_pair.rb,
lib/fog/aws/requests/compute/delete_snapshot.rb,
lib/fog/aws/requests/compute/describe_images.rb,
lib/fog/aws/requests/compute/import_key_pair.rb,
lib/fog/aws/requests/compute/release_address.rb,
lib/fog/aws/requests/compute/start_instances.rb,
lib/fog/aws/requests/compute/allocate_address.rb,
lib/fog/aws/requests/compute/deregister_image.rb,
lib/fog/aws/requests/compute/describe_regions.rb,
lib/fog/aws/requests/compute/describe_subnets.rb,
lib/fog/aws/requests/compute/describe_volumes.rb,
lib/fog/aws/requests/compute/reboot_instances.rb,
lib/fog/aws/requests/compute/associate_address.rb,
lib/fog/aws/requests/compute/get_password_data.rb,
lib/fog/aws/requests/compute/monitor_instances.rb,
lib/fog/aws/requests/compute/create_network_acl.rb,
lib/fog/aws/requests/compute/create_route_table.rb,
lib/fog/aws/requests/compute/delete_network_acl.rb,
lib/fog/aws/requests/compute/delete_route_table.rb,
lib/fog/aws/requests/compute/describe_addresses.rb,
lib/fog/aws/requests/compute/describe_instances.rb,
lib/fog/aws/requests/compute/describe_key_pairs.rb,
lib/fog/aws/requests/compute/describe_snapshots.rb,
lib/fog/aws/requests/compute/get_console_output.rb,
lib/fog/aws/requests/compute/create_dhcp_options.rb,
lib/fog/aws/requests/compute/delete_dhcp_options.rb,
lib/fog/aws/requests/compute/move_address_to_vpc.rb,
lib/fog/aws/requests/compute/terminate_instances.rb,
lib/fog/aws/requests/compute/unmonitor_instances.rb,
lib/fog/aws/requests/compute/disassociate_address.rb,
lib/fog/aws/requests/compute/modify_vpc_attribute.rb,
lib/fog/aws/requests/compute/associate_route_table.rb,
lib/fog/aws/requests/compute/create_security_group.rb,
lib/fog/aws/requests/compute/delete_security_group.rb,
lib/fog/aws/requests/compute/describe_dhcp_options.rb,
lib/fog/aws/requests/compute/describe_network_acls.rb,
lib/fog/aws/requests/compute/describe_route_tables.rb,
lib/fog/aws/requests/compute/associate_dhcp_options.rb,
lib/fog/aws/requests/compute/create_placement_group.rb,
lib/fog/aws/requests/compute/delete_placement_group.rb,
lib/fog/aws/requests/compute/describe_volume_status.rb,
lib/fog/aws/requests/compute/describe_vpc_attribute.rb,
lib/fog/aws/requests/compute/modify_image_attribute.rb,
lib/fog/aws/requests/compute/request_spot_instances.rb,
lib/fog/aws/requests/compute/attach_classic_link_vpc.rb,
lib/fog/aws/requests/compute/attach_internet_gateway.rb,
lib/fog/aws/requests/compute/create_internet_gateway.rb,
lib/fog/aws/requests/compute/delete_internet_gateway.rb,
lib/fog/aws/requests/compute/detach_classic_link_vpc.rb,
lib/fog/aws/requests/compute/detach_internet_gateway.rb,
lib/fog/aws/requests/compute/enable_vpc_classic_link.rb,
lib/fog/aws/requests/compute/modify_subnet_attribute.rb,
lib/fog/aws/requests/compute/modify_volume_attribute.rb,
lib/fog/aws/requests/compute/attach_network_interface.rb,
lib/fog/aws/requests/compute/create_network_acl_entry.rb,
lib/fog/aws/requests/compute/create_network_interface.rb,
lib/fog/aws/requests/compute/delete_network_acl_entry.rb,
lib/fog/aws/requests/compute/delete_network_interface.rb,
lib/fog/aws/requests/compute/describe_image_attribute.rb,
lib/fog/aws/requests/compute/describe_instance_status.rb,
lib/fog/aws/requests/compute/describe_security_groups.rb,
lib/fog/aws/requests/compute/detach_network_interface.rb,
lib/fog/aws/requests/compute/disable_vpc_classic_link.rb,
lib/fog/aws/requests/compute/disassociate_route_table.rb,
lib/fog/aws/requests/compute/describe_placement_groups.rb,
lib/fog/aws/requests/compute/describe_vpc_classic_link.rb,
lib/fog/aws/requests/compute/modify_instance_attribute.rb,
lib/fog/aws/requests/compute/modify_instance_placement.rb,
lib/fog/aws/requests/compute/modify_snapshot_attribute.rb,
lib/fog/aws/requests/compute/replace_network_acl_entry.rb,
lib/fog/aws/requests/compute/describe_internet_gateways.rb,
lib/fog/aws/requests/compute/restore_address_to_classic.rb,
lib/fog/aws/requests/compute/assign_private_ip_addresses.rb,
lib/fog/aws/requests/compute/describe_account_attributes.rb,
lib/fog/aws/requests/compute/describe_availability_zones.rb,
lib/fog/aws/requests/compute/describe_instance_attribute.rb,
lib/fog/aws/requests/compute/describe_network_interfaces.rb,
lib/fog/aws/requests/compute/describe_reserved_instances.rb,
lib/fog/aws/requests/compute/describe_spot_price_history.rb,
lib/fog/aws/requests/compute/revoke_security_group_egress.rb,
lib/fog/aws/requests/compute/cancel_spot_instance_requests.rb,
lib/fog/aws/requests/compute/revoke_security_group_ingress.rb,
lib/fog/aws/requests/compute/describe_volumes_modifications.rb,
lib/fog/aws/requests/compute/authorize_security_group_egress.rb,
lib/fog/aws/requests/compute/describe_classic_link_instances.rb,
lib/fog/aws/requests/compute/describe_spot_instance_requests.rb,
lib/fog/aws/requests/compute/replace_network_acl_association.rb,
lib/fog/aws/requests/compute/authorize_security_group_ingress.rb,
lib/fog/aws/requests/compute/create_spot_datafeed_subscription.rb,
lib/fog/aws/requests/compute/delete_spot_datafeed_subscription.rb,
lib/fog/aws/requests/compute/reset_network_interface_attribute.rb,
lib/fog/aws/requests/compute/modify_network_interface_attribute.rb,
lib/fog/aws/requests/compute/describe_spot_datafeed_subscription.rb,
lib/fog/aws/requests/compute/enable_vpc_classic_link_dns_support.rb,
lib/fog/aws/requests/compute/describe_network_interface_attribute.rb,
lib/fog/aws/requests/compute/disable_vpc_classic_link_dns_support.rb,
lib/fog/aws/requests/compute/purchase_reserved_instances_offering.rb,
lib/fog/aws/requests/compute/describe_reserved_instances_offerings.rb,
lib/fog/aws/requests/compute/describe_vpc_classic_link_dns_support.rb

Overview

deprecation

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Fog::AWS::CredentialFetcher::ConnectionMethods

#refresh_credentials_if_expired

Constructor Details

#initialize(options = {}) ⇒ Real

Returns a new instance of Real.



552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
# File 'lib/fog/aws/compute.rb', line 552

def initialize(options={})

  @connection_options           = options[:connection_options] || {}
  @region                       = options[:region] ||= 'us-east-1'
  @instrumentor                 = options[:instrumentor]
  @instrumentor_name            = options[:instrumentor_name] || 'fog.aws.compute'
  @version                      = options[:version]     ||  '2016-11-15'
  @retry_request_limit_exceeded = options.fetch(:retry_request_limit_exceeded, true)
  @retry_jitter_magnitude       = options[:retry_jitter_magnitude] || 0.1

  @use_iam_profile = options[:use_iam_profile]
  setup_credentials(options)

  if @endpoint = options[:endpoint]
    endpoint = URI.parse(@endpoint)
    @host = endpoint.host or raise InvalidURIError.new("could not parse endpoint: #{@endpoint}")
    @path = endpoint.path
    @port = endpoint.port
    @scheme = endpoint.scheme
  else
    @host = options[:host] || "ec2.#{options[:region]}.amazonaws.com"
    @path       = options[:path]        || '/'
    @persistent = options[:persistent]  || false
    @port       = options[:port]        || 443
    @scheme     = options[:scheme]      || 'https'
  end

  Fog::AWS.validate_region!(@region, @host)
  @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
end

Instance Attribute Details

#regionObject

Initialize connection to EC2

Notes

options parameter must include values for :aws_access_key_id and :aws_secret_access_key in order to create a connection

Examples

sdb = SimpleDB.new(
 :aws_access_key_id => your_aws_access_key_id,
 :aws_secret_access_key => your_aws_secret_access_key
)

Parameters

  • options<~Hash> - config arguments for connection. Defaults to {}.

    • region<~String> - optional region to use. For instance, ‘eu-west-1’, ‘us-east-1’, and etc.

    • aws_session_token<~String> - when using Session Tokens or Federated Users, a session_token must be presented

Returns

  • EC2 object with connection to aws.



550
551
552
# File 'lib/fog/aws/compute.rb', line 550

def region
  @region
end

Instance Method Details

#allocate_address(domain = 'standard') ⇒ Object

Acquire an elastic IP address.

Parameters

  • domain<~String> - Type of EIP, either standard or vpc

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘publicIp’<~String> - The acquired address

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

Amazon API Reference



18
19
20
21
22
23
24
25
# File 'lib/fog/aws/requests/compute/allocate_address.rb', line 18

def allocate_address(domain='standard')
  domain = domain == 'vpc' ? 'vpc' : 'standard'
  request(
    'Action'  => 'AllocateAddress',
    'Domain'  => domain,
    :parser   => Fog::Parsers::AWS::Compute::AllocateAddress.new
  )
end

#assign_private_ip_addresses(network_interface_id, options = {}) ⇒ Object

Assigns one or more secondary private IP addresses to the specified network interface.

Parameters

  • NetworkInterfaceId<~String> - The ID of the network interface

  • PrivateIpAddresses<~Array> - One or more IP addresses to be assigned as a secondary private IP address (conditional)

  • SecondaryPrivateIpAddressCount<~String> - The number of secondary IP addresses to assign (conditional)

  • AllowReassignment<~Boolean> - Whether to reassign an IP address

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘requestId’<~String> - The ID of the request.

      • ‘return’<~Boolean> - success?

Amazon API Reference



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fog/aws/requests/compute/assign_private_ip_addresses.rb', line 21

def assign_private_ip_addresses(network_interface_id, options={})
  if options['PrivateIpAddresses'] && options['SecondaryPrivateIpAddressCount']
    raise Fog::AWS::Compute::Error.new("You may specify secondaryPrivateIpAddressCount or specific secondary private IP addresses, but not both.")
  end

  if private_ip_addresses = options.delete('PrivateIpAddresses')
    options.merge!(Fog::AWS.indexed_param('PrivateIpAddress.%d', [*private_ip_addresses]))
  end

  request({
    'Action'  => 'AssignPrivateIpAddresses',
    'NetworkInterfaceId' => network_interface_id,
    :parser   => Fog::Parsers::AWS::Compute::AssignPrivateIpAddresses.new
  }.merge(options))
end

#associate_address(*args) ⇒ Object

Associate an elastic IP address with an instance

Parameters

  • instance_id<~String> - Id of instance to associate address with (conditional)

  • public_ip<~String> - Public ip to assign to instance (conditional)

  • network_interface_id<~String> - Id of a nic to associate address with (required in a vpc instance with more than one nic) (conditional)

  • allocation_id<~String> - Allocation Id to associate address with (vpc only) (conditional)

  • private_ip_address<~String> - Private Ip Address to associate address with (vpc only)

  • allow_reassociation<~Boolean> - Allows an elastic ip address to be reassigned (vpc only) (conditional)

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - success?

      • ‘associationId’<~String> - association Id for eip to node (vpc only)

Amazon API Reference



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/fog/aws/requests/compute/associate_address.rb', line 25

def associate_address(*args)
  if args.first.kind_of? Hash
    params = args.first
  else
    params = {
        :instance_id => args[0],
        :public_ip => args[1],
        :network_interface_id => args[2],
        :allocation_id => args[3],
        :private_ip_address => args[4],
        :allow_reassociation => args[5],
    }
  end
  # Cannot specify an allocation ip and a public IP at the same time.  If you have an allocation Id presumably you are in a VPC
  # so we will null out the public IP
  params[:public_ip] = params[:allocation_id].nil? ? params[:public_ip] : nil

  request(
    'Action'             => 'AssociateAddress',
    'AllocationId'       => params[:allocation_id],
    'InstanceId'         => params[:instance_id],
    'NetworkInterfaceId' => params[:network_interface_id],
    'PublicIp'           => params[:public_ip],
    'PrivateIpAddress'   => params[:private_ip_address],
    'AllowReassociation' => params[:allow_reassociation],
    :idempotent          => true,
    :parser              => Fog::Parsers::AWS::Compute::AssociateAddress.new
  )
end

#associate_dhcp_options(dhcp_options_id, vpc_id) ⇒ Object

Parameters

  • dhcp_options_id<~String> - The ID of the DHCP options you want to associate with the VPC, or “default” if you want the VPC to use no DHCP options.

  • vpc_id<~String> - The ID of the VPC

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - Returns true if the request succeeds.

Amazon API Reference



20
21
22
23
24
25
26
27
28
# File 'lib/fog/aws/requests/compute/associate_dhcp_options.rb', line 20

def associate_dhcp_options(dhcp_options_id, vpc_id)
  request(
    'Action'               => 'AssociateDhcpOptions',
    'DhcpOptionsId'        => dhcp_options_id,
    'VpcId'                => vpc_id,
    :idempotent   => true,
    :parser       => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#associate_route_table(routeTableId, subnetId) ⇒ Object

Associates a subnet with a route table.

Parameters

  • RouteTableId<~String> - The ID of the route table

  • SubnetId<~String> - The ID of the subnet

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘requestId’<~String> - The ID of the request

      • ‘associationId’<~String> - The route table association ID (needed to disassociate the route table)

Amazon API Reference



19
20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/compute/associate_route_table.rb', line 19

def associate_route_table(routeTableId, subnetId)
  request(
    'Action'       => 'AssociateRouteTable',
    'RouteTableId' => routeTableId,
    'SubnetId'     => subnetId,
    :parser        => Fog::Parsers::AWS::Compute::AssociateRouteTable.new
  )
end

Links an EC2-Classic instance to a ClassicLink-enabled VPC through one or more of the VPC’s security groups

Parameters

  • vpc_id<~String> - The ID of a ClassicLink-enabled VPC.

  • instance_id<~String> - The ID of an EC2-Classic instance to link to the ClassicLink-enabled VPC.

  • security_group_ids<~String> - The ID of one or more of the VPC’s security groups. You cannot specify security groups from a different VPC.

  • dry_run<~Boolean> - defaults to false

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘return’<~Boolean> - Whether the request succeeded

(Amazon API Reference)



21
22
23
24
25
26
27
28
29
30
# File 'lib/fog/aws/requests/compute/attach_classic_link_vpc.rb', line 21

def attach_classic_link_vpc(instance_id, vpc_id, security_group_ids, dry_run=false)
  request({
    'Action'    => 'AttachClassicLinkVpc',
    'VpcId'     => vpc_id,
    'InstanceId'=> instance_id,
    'DryRun'    => dry_run,
    :parser     => Fog::Parsers::AWS::Compute::Basic.new
  }.merge(Fog::AWS.indexed_param('SecurityGroupId', security_group_ids)))

end

#attach_internet_gateway(internet_gateway_id, vpc_id) ⇒ Object

Attaches an Internet gateway to a VPC, enabling connectivity between the Internet and the VPC

Parameters

  • internet_gateway_id<~String> - The ID of the Internet gateway to attach

  • vpc_id<~String> - The ID of the VPC

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - Returns true if the request succeeds.

Amazon API Reference



19
20
21
22
23
24
25
26
27
# File 'lib/fog/aws/requests/compute/attach_internet_gateway.rb', line 19

def attach_internet_gateway(internet_gateway_id, vpc_id)
  request(
    'Action'               => 'AttachInternetGateway',
    'InternetGatewayId'    => internet_gateway_id,
    'VpcId'                => vpc_id,
    :idempotent   => true,
    :parser       => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#attach_network_interface(nic_id, instance_id, device_index) ⇒ Object

Attach a network interface

Parameters

  • networkInterfaceId<~String> - ID of the network interface to attach

  • instanceId<~String> - ID of the instance that will be attached to the network interface

  • deviceIndex<~Integer> - index of the device for the network interface attachment on the instance

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘attachmentId’<~String> - ID of the attachment

Amazon API Reference



21
22
23
24
25
26
27
28
29
# File 'lib/fog/aws/requests/compute/attach_network_interface.rb', line 21

def attach_network_interface(nic_id, instance_id, device_index)
  request(
    'Action' => 'AttachNetworkInterface',
    'NetworkInterfaceId' => nic_id,
    'InstanceId'         => instance_id,
    'DeviceIndex'        => device_index,
    :parser => Fog::Parsers::AWS::Compute::AttachNetworkInterface.new
  )
end

#attach_volume(instance_id, volume_id, device) ⇒ Object

Attach an Amazon EBS volume with a running instance, exposing as specified device

Parameters

  • instance_id<~String> - Id of instance to associate volume with

  • volume_id<~String> - Id of amazon EBS volume to associate with instance

  • device<~String> - Specifies how the device is exposed to the instance (e.g. “/dev/sdh”)

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘attachTime’<~Time> - Time of attachment was initiated at

      • ‘device’<~String> - Device as it is exposed to the instance

      • ‘instanceId’<~String> - Id of instance for volume

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

      • ‘status’<~String> - Status of volume

      • ‘volumeId’<~String> - Reference to volume

Amazon API Reference



25
26
27
28
29
30
31
32
33
34
# File 'lib/fog/aws/requests/compute/attach_volume.rb', line 25

def attach_volume(instance_id, volume_id, device)
  request(
    'Action'      => 'AttachVolume',
    'VolumeId'    => volume_id,
    'InstanceId'  => instance_id,
    'Device'      => device,
    :idempotent   => true,
    :parser       => Fog::Parsers::AWS::Compute::AttachVolume.new
  )
end

#authorize_security_group_egress(group_name, options = {}) ⇒ Object

Add permissions to a security group

Parameters

  • group_name<~String> - Name of group, optional (can also be specified as GroupName in options)

  • options<~Hash>:

    • ‘GroupName’<~String> - Name of security group to modify

    • ‘GroupId’<~String> - Id of security group to modify

    • ‘SourceSecurityGroupName’<~String> - Name of security group to authorize

    • ‘SourceSecurityGroupOwnerId’<~String> - Name of owner to authorize

    or

    • ‘CidrIp’<~String> - CIDR range

    • ‘FromPort’<~Integer> - Start of port range (or -1 for ICMP wildcard)

    • ‘IpProtocol’<~String> - Ip protocol, must be in [‘tcp’, ‘udp’, ‘icmp’]

    • ‘ToPort’<~Integer> - End of port range (or -1 for ICMP wildcard)

    or

    • ‘IpPermissions’<~Array>:

      • permission<~Hash>:

        • ‘FromPort’<~Integer> - Start of port range (or -1 for ICMP wildcard)

        • ‘Groups’<~Array>:

          • group<~Hash>:

            • ‘GroupName’<~String> - Name of security group to authorize

            • ‘UserId’<~String> - Name of owner to authorize

        • ‘IpProtocol’<~String> - Ip protocol, must be in [‘tcp’, ‘udp’, ‘icmp’]

        • ‘IpRanges’<~Array>:

          • ip_range<~Hash>:

            • ‘CidrIp’<~String> - CIDR range

        • ‘ToPort’<~Integer> - End of port range (or -1 for ICMP wildcard)

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - success?

Amazon API Reference



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/fog/aws/requests/compute/authorize_security_group_egress.rb', line 42

def authorize_security_group_egress(group_name, options = {})
  options = Fog::AWS.parse_security_group_options(group_name, options)

  if ip_permissions = options.delete('IpPermissions')
    options.merge!(indexed_ip_permissions_params(ip_permissions))
  end

  request({
    'Action'    => 'AuthorizeSecurityGroupEgress',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::Basic.new
  }.merge!(options))
end

#authorize_security_group_ingress(group_name, options = {}) ⇒ Object

Add permissions to a security group

Parameters

  • group_name<~String> - Name of group, optional (can also be specified as GroupName in options)

  • options<~Hash>:

    • ‘GroupName’<~String> - Name of security group to modify

    • ‘GroupId’<~String> - Id of security group to modify

    • ‘SourceSecurityGroupName’<~String> - Name of security group to authorize

    • ‘SourceSecurityGroupOwnerId’<~String> - Name of owner to authorize

    or

    • ‘CidrIp’<~String> - CIDR range

    • ‘FromPort’<~Integer> - Start of port range (or -1 for ICMP wildcard)

    • ‘IpProtocol’<~String> - Ip protocol, must be in [‘tcp’, ‘udp’, ‘icmp’]

    • ‘ToPort’<~Integer> - End of port range (or -1 for ICMP wildcard)

    or

    • ‘IpPermissions’<~Array>:

      • permission<~Hash>:

        • ‘FromPort’<~Integer> - Start of port range (or -1 for ICMP wildcard)

        • ‘Groups’<~Array>:

          • group<~Hash>:

            • ‘GroupName’<~String> - Name of security group to authorize

            • ‘UserId’<~String> - Name of owner to authorize

        • ‘IpProtocol’<~String> - Ip protocol, must be in [‘tcp’, ‘udp’, ‘icmp’]

        • ‘IpRanges’<~Array>:

          • ip_range<~Hash>:

            • ‘CidrIp’<~String> - CIDR range

        • ‘Ipv6Ranges’<~Array>:

          • ip_range<~Hash>:

            • ‘CidrIpv6’<~String> - CIDR range

        • ‘ToPort’<~Integer> - End of port range (or -1 for ICMP wildcard)

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - success?

Amazon API Reference



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/fog/aws/requests/compute/authorize_security_group_ingress.rb', line 45

def authorize_security_group_ingress(group_name, options = {})
  options = Fog::AWS.parse_security_group_options(group_name, options)

  if ip_permissions = options.delete('IpPermissions')
    options.merge!(indexed_ip_permissions_params(ip_permissions))
  end

  request({
    'Action'    => 'AuthorizeSecurityGroupIngress',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::Basic.new
  }.merge!(options))
end

#cancel_spot_instance_requests(spot_instance_request_id) ⇒ Object

Terminate specified spot instance requests

Parameters

  • spot_instance_request_id<~Array> - Ids of instances to terminates

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘requestId’<~String> id of request

      • ‘spotInstanceRequestSet’<~Array>:

        • ‘spotInstanceRequestId’<~String> - id of cancelled spot instance

        • ‘state’<~String> - state of cancelled spot instance

Amazon API Reference



21
22
23
24
25
26
27
28
# File 'lib/fog/aws/requests/compute/cancel_spot_instance_requests.rb', line 21

def cancel_spot_instance_requests(spot_instance_request_id)
  params = Fog::AWS.indexed_param('SpotInstanceRequestId', spot_instance_request_id)
  request({
    'Action'    => 'CancelSpotInstanceRequests',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::CancelSpotInstanceRequests.new
  }.merge!(params))
end

#copy_image(source_image_id, source_region, name = nil, description = nil, client_token = nil) ⇒ Object

Copy an image to a different region

Parameters

  • source_image_id<~String> - The ID of the AMI to copy

  • source_region<~String> - The name of the AWS region that contains the AMI to be copied

  • name<~String> - The name of the new AMI in the destination region

  • description<~String> - The description to set on the new AMI in the destination region

  • client_token<~String> - Unique, case-sensitive identifier you provide to ensure idempotency of the request

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘imageId’<~String> - id of image

Amazon API Reference



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fog/aws/requests/compute/copy_image.rb', line 23

def copy_image(source_image_id, source_region, name = nil, description = nil, client_token = nil)
  request(
    'Action'          => 'CopyImage',
    'SourceImageId'   => source_image_id,
    'SourceRegion'    => source_region,
    'Name'            => name,
    'Description'     => description,
    'ClientToken'     => client_token,
    :parser           => Fog::Parsers::AWS::Compute::CopyImage.new
  )
end

#copy_snapshot(source_snapshot_id, source_region, options = {}) ⇒ Object

Copy a snapshot to a different region

Parameters

  • source_snapshot_id<~String> - Id of snapshot

  • source_region<~String> - Region to move it from

  • options<~Hash>:

    • ‘Description’<~String> - A description for the EBS snapshot

    • ‘Encrypted’<~Boolean> - Specifies whether the destination snapshot should be encrypted

    • ‘KmsKeyId’<~String> - The full ARN of the AWS Key Management Service (AWS KMS) CMK

      to use when creating the snapshot copy.
      

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘snapshotId’<~String> - id of snapshot

Amazon API Reference



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/fog/aws/requests/compute/copy_snapshot.rb', line 25

def copy_snapshot(source_snapshot_id, source_region, options = {})
  # For backward compatibility. In previous versions third param was a description
  if options.is_a?(String)
    Fog::Logger.warning("copy_snapshot with description as a string in third param is deprecated, use hash instead: copy_snapshot('source-id', 'source-region', { 'Description' => 'some description' })")
    options = { 'Description' => options }
  end
  params              = {
    'Action'           => 'CopySnapshot',
    'SourceSnapshotId' => source_snapshot_id,
    'SourceRegion'     => source_region,
    'Description'      => options['Description'],
    :parser            => Fog::Parsers::AWS::Compute::CopySnapshot.new
  }
  params['Encrypted'] = true if options['Encrypted']
  params['KmsKeyId']  = options['KmsKeyId'] if options['Encrypted'] && options['KmsKeyId']
  request(params)
end

#create_dhcp_options(dhcp_configurations = {}) ⇒ Object

Creates a set of DHCP options for your VPC

Parameters

  • DhcpConfigurationOptions<~Hash> - hash of key value dhcp options to assign

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

Amazon API Reference



18
19
20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/compute/create_dhcp_options.rb', line 18

def create_dhcp_options(dhcp_configurations = {})
  params = {}
  params.merge!(indexed_multidimensional_params(dhcp_configurations))
  request({
    'Action'    => 'CreateDhcpOptions',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::CreateDhcpOptions.new
  }.merge!(params))
end

#create_image(instance_id, name, description, no_reboot = false, options = {}) ⇒ Object

Create a bootable EBS volume AMI

Parameters

  • instance_id<~String> - Instance used to create image.

  • name<~Name> - Name to give image.

  • description<~Name> - Description of image.

  • no_reboot<~Boolean> - Optional, whether or not to reboot the image when making the snapshot

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘imageId’<~String> - The ID of the created AMI.

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

Amazon API Reference



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/fog/aws/requests/compute/create_image.rb', line 22

def create_image(instance_id, name, description, no_reboot = false, options={})
  params = {}
  block_device_mappings = options[:block_device_mappings] ||  []

  params.merge!Fog::AWS.indexed_param('BlockDeviceMapping.%d.DeviceName', block_device_mappings.map{|mapping| mapping['DeviceName']})
  params.merge!Fog::AWS.indexed_param('BlockDeviceMapping.%d.NoDevice', block_device_mappings.map{|mapping| mapping['NoDevice']})
  params.merge!Fog::AWS.indexed_param('BlockDeviceMapping.%d.VirtualName', block_device_mappings.map{|mapping| mapping['VirtualName']})
  params.merge!Fog::AWS.indexed_param('BlockDeviceMapping.%d.Ebs.SnapshotId', block_device_mappings.map{|mapping| mapping['Ebs.SnapshotId']})
  params.merge!Fog::AWS.indexed_param('BlockDeviceMapping.%d.Ebs.DeleteOnTermination', block_device_mappings.map{|mapping| mapping['Ebs.DeleteOnTermination']})
  params.merge!Fog::AWS.indexed_param('BlockDeviceMapping.%d.Ebs.VolumeType', block_device_mappings.map{|mapping| mapping['Ebs.VolumeType']})
  params.merge!Fog::AWS.indexed_param('BlockDeviceMapping.%d.Ebs.Encrypted', block_device_mappings.map{|mapping| mapping['Ebs.Encrypted']})
  params.merge!Fog::AWS.indexed_param('BlockDeviceMapping.%d.Ebs.Iops', block_device_mappings.map{|mapping| mapping['Ebs.Iops']})
  params.reject!{|k,v| v.nil?}

  request({
    'Action'            => 'CreateImage',
    'InstanceId'        => instance_id,
    'Name'              => name,
    'Description'       => description,
    'NoReboot'          => no_reboot.to_s,
    :parser             => Fog::Parsers::AWS::Compute::CreateImage.new
  }.merge!(params))
end

#create_internet_gatewayObject

Creates an InternetGateway

Parameters

(none)

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘internetGateway’<~Array>:

  • ‘attachmentSet’<~Array>: A list of VPCs attached to the Internet gateway

  • ‘vpcId’<~String> - The ID of the VPC the Internet gateway is attached to.

  • ‘state’<~String> - The current state of the attachment.

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

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

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

Amazon API Reference



25
26
27
28
29
30
# File 'lib/fog/aws/requests/compute/create_internet_gateway.rb', line 25

def create_internet_gateway()
  request({
    'Action'     => 'CreateInternetGateway',
    :parser      => Fog::Parsers::AWS::Compute::CreateInternetGateway.new
  })
end

#create_key_pair(key_name) ⇒ Object

Create a new key pair

Parameters

  • key_name<~String> - Unique name for key pair.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘keyFingerprint’<~String> - SHA-1 digest of DER encoded private key

      • ‘keyMaterial’<~String> - Unencrypted encoded PEM private key

      • ‘keyName’<~String> - Name of key

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

Amazon API Reference



21
22
23
24
25
26
27
# File 'lib/fog/aws/requests/compute/create_key_pair.rb', line 21

def create_key_pair(key_name)
  request(
    'Action'  => 'CreateKeyPair',
    'KeyName' => key_name,
    :parser   => Fog::Parsers::AWS::Compute::CreateKeyPair.new
  )
end

#create_network_acl(vpcId, options = {}) ⇒ Object

Creates a network ACL

Parameters

  • vpcId<~String> - The ID of the VPC to create this network ACL under

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘networkAcl’<~Array>: - The network ACL

  • ‘networkAclId’<~String> - The ID of the network ACL

  • ‘vpcId’<~String> - The ID of the VPC for the network ACL

  • ‘default’<~Boolean> - Indicates whether this is the default network ACL for the VPC

  • ‘entrySet’<~Array>: - A list of entries (rules) in the network ACL

  • ‘ruleNumber’<~Integer> - The rule number for the entry. ACL entries are processed in ascending order by rule number

  • ‘protocol’<~Integer> - The protocol. A value of -1 means all protocols

  • ‘ruleAction’<~String> - Indicates whether to allow or deny the traffic that matches the rule

  • ‘egress’<~Boolean> - Indicates whether the rule is an egress rule (applied to traffic leaving the subnet)

  • ‘cidrBlock’<~String> - The network range to allow or deny, in CIDR notation

  • ‘icmpTypeCode’<~Hash> - ICMP protocol: The ICMP type and code

  • ‘code’<~Integer> - The ICMP code. A value of -1 means all codes for the specified ICMP type

  • ‘type’<~Integer> - The ICMP type. A value of -1 means all types

  • ‘portRange’<~Hash> - TCP or UDP protocols: The range of ports the rule applies to

  • ‘from’<~Integer> - The first port in the range

  • ‘to’<~Integer> - The last port in the range

  • ‘associationSet’<~Array>: - A list of associations between the network ACL and subnets

  • ‘networkAclAssociationId’<~String> - The ID of the association

  • ‘networkAclId’<~String> - The ID of the network ACL

  • ‘subnetId’<~String> - The ID of the subnet

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

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

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

Amazon API Reference



41
42
43
44
45
46
47
# File 'lib/fog/aws/requests/compute/create_network_acl.rb', line 41

def create_network_acl(vpcId, options = {})
  request({
    'Action' => 'CreateNetworkAcl',
    'VpcId'  => vpcId,
    :parser  => Fog::Parsers::AWS::Compute::CreateNetworkAcl.new
  }.merge!(options))
end

#create_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options = {}) ⇒ Object

Creates a Network ACL entry

Parameters

  • network_acl_id<~String> - The ID of the ACL to add this entry to

  • rule_number<~Integer> - The rule number for the entry, between 100 and 32766

  • protocol<~Integer> - The IP protocol to which the rule applies. You can use -1 to mean all protocols.

  • rule_action<~String> - Allows or denies traffic that matches the rule. (either allow or deny)

  • cidr_block<~String> - The CIDR range to allow or deny

  • egress<~Boolean> - Indicates whether this rule applies to egress traffic from the subnet (true) or ingress traffic to the subnet (false).

  • options<~Hash>:

  • ‘Icmp.Code’ - ICMP code, required if protocol is 1

  • ‘Icmp.Type’ - ICMP type, required if protocol is 1

  • ‘PortRange.From’ - The first port in the range, required if protocol is 6 (TCP) or 17 (UDP)

  • ‘PortRange.To’ - The last port in the range, required if protocol is 6 (TCP) or 17 (UDP)

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘return’<~Boolean> - Returns true if the request succeeds.

Amazon API Reference



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

def create_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options = {})
  request({
    'Action'       => 'CreateNetworkAclEntry',
    'NetworkAclId' => network_acl_id,
    'RuleNumber'   => rule_number,
    'Protocol'     => protocol,
    'RuleAction'   => rule_action,
    'Egress'       => egress,
    'CidrBlock'    => cidr_block,
    :parser        => Fog::Parsers::AWS::Compute::Basic.new
  }.merge!(options))
end

#create_network_interface(subnetId, options = {}) ⇒ Object

Creates a network interface

Parameters

  • subnetId<~String> - The ID of the subnet to associate with the network interface

  • options<~Hash>:

    • PrivateIpAddress<~String> - The private IP address of the network interface

    • Description<~String> - The description of the network interface

    • GroupSet<~Array> - The security group IDs for use by the network interface

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘networkInterface’<~Hash> - The created network interface

  • ‘networkInterfaceId’<~String> - The ID of the network interface

  • ‘subnetId’<~String> - The ID of the subnet

  • ‘vpcId’<~String> - The ID of the VPC

  • ‘availabilityZone’<~String> - The availability zone

  • ‘description’<~String> - The description

  • ‘ownerId’<~String> - The ID of the person who created the interface

  • ‘requesterId’<~String> - The ID or the entity requesting this interface

  • ‘requesterManaged’<~String> -

  • ‘status’<~String> - “available” or “in-use”

  • ‘macAddress’<~String> -

  • ‘privateIpAddress’<~String> - IP address of the interface within the subnet

  • ‘privateDnsName’<~String> - The private DNS name

  • ‘sourceDestCheck’<~Boolean> - Flag indicating whether traffic to or from the instance is validated

  • ‘groupSet’<~Hash> - Associated security groups

  • ‘key’<~String> - ID of associated group

  • ‘value’<~String> - Name of associated group

  • ‘attachment’<~Hash>: - Describes the way this nic is attached

  • ‘attachmentID’<~String>

  • ‘instanceID’<~String>

  • ‘association’<~Hash>: - Describes an eventual instance association

  • ‘attachmentID’<~String> - ID of the network interface attachment

  • ‘instanceID’<~String> - ID of the instance attached to the network interface

  • ‘publicIp’<~String> - Address of the Elastic IP address bound to the network interface

  • ‘ipOwnerId’<~String> - ID of the Elastic IP address owner

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

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

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

Amazon API Reference



51
52
53
54
55
56
57
58
59
60
# File 'lib/fog/aws/requests/compute/create_network_interface.rb', line 51

def create_network_interface(subnetId, options = {})
  if security_groups = options.delete('GroupSet')
    options.merge!(Fog::AWS.indexed_param('SecurityGroupId', [*security_groups]))
  end
  request({
    'Action'     => 'CreateNetworkInterface',
    'SubnetId'   => subnetId,
    :parser      => Fog::Parsers::AWS::Compute::CreateNetworkInterface.new
  }.merge!(options))
end

#create_placement_group(name, strategy) ⇒ Object

Create a new placement group

Parameters

  • group_name<~String> - Name of the placement group.

  • strategy<~String> - Placement group strategy. Valid options in [‘cluster’]

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - success?

Amazon API Reference



20
21
22
23
24
25
26
27
# File 'lib/fog/aws/requests/compute/create_placement_group.rb', line 20

def create_placement_group(name, strategy)
  request(
    'Action'            => 'CreatePlacementGroup',
    'GroupName'         => name,
    'Strategy'          => strategy,
    :parser             => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#create_route(route_table_id, destination_cidr_block, internet_gateway_id = nil, instance_id = nil, network_interface_id = nil) ⇒ Object

Creates a route in a route table within a VPC.

Parameters

  • RouteTableId<~String> - The ID of the route table for the route.

  • DestinationCidrBlock<~String> - The CIDR address block used for the destination match. Routing decisions are based on the most specific match.

  • GatewayId<~String> - The ID of an Internet gateway attached to your VPC.

  • InstanceId<~String> - The ID of a NAT instance in your VPC. The operation fails if you specify an instance ID unless exactly one network interface is attached.

  • NetworkInterfaceId<~String> - The ID of a network interface.

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘return’<~Boolean> - Returns true if the request succeeds. Otherwise, returns an error.

Amazon API Reference



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/fog/aws/requests/compute/create_route.rb', line 23

def create_route(route_table_id, destination_cidr_block, internet_gateway_id=nil, instance_id=nil, network_interface_id=nil)
  request_vars = {
    'Action'                => 'CreateRoute',
    'RouteTableId'          => route_table_id,
    'DestinationCidrBlock'  => destination_cidr_block,
    :parser                 => Fog::Parsers::AWS::Compute::Basic.new
  }
  if internet_gateway_id
    request_vars['GatewayId'] = internet_gateway_id
  elsif instance_id
    request_vars['InstanceId'] = instance_id
  elsif network_interface_id
    request_vars['NetworkInterfaceId'] = network_interface_id
  end
  request(request_vars)
end

#create_route_table(vpc_id) ⇒ Object

Creates a route table for the specified VPC.

Parameters

  • VpcId<~String> - The ID of the VPC.

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘routeTable’<~Array> - Information about the newly created route table

  • ‘routeTableId’<~String>

  • ‘vpcId’<~String>

  • ‘routeSet’<~Array>

  • ‘item’<~Array>

  • ‘destinationCidrBlock’<~String> - The CIDR address block used for the destination match.

  • ‘gatewayId’<~String> - The ID of an Internet gateway attached to your VPC.

  • ‘state’<~String> - The state of the route. [‘blackhole’, ‘available’]

Amazon API Reference



26
27
28
29
30
31
32
# File 'lib/fog/aws/requests/compute/create_route_table.rb', line 26

def create_route_table(vpc_id)
  request({
    'Action' => 'CreateRouteTable',
    'VpcId' => vpc_id,
    :parser => Fog::Parsers::AWS::Compute::CreateRouteTable.new
  })
end

#create_security_group(name, description, vpc_id = nil) ⇒ Object

Create a new security group

Parameters

  • group_name<~String> - Name of the security group.

  • group_description<~String> - Description of group.

  • vpc_id<~String> - ID of the VPC

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - success?

      • ‘groupId’<~String> - Id of created group

Amazon API Reference



22
23
24
25
26
27
28
29
30
# File 'lib/fog/aws/requests/compute/create_security_group.rb', line 22

def create_security_group(name, description, vpc_id=nil)
  request(
    'Action'            => 'CreateSecurityGroup',
    'GroupName'         => name,
    'GroupDescription'  => description,
    'VpcId'             => vpc_id,
    :parser             => Fog::Parsers::AWS::Compute::CreateSecurityGroup.new
  )
end

#create_snapshot(volume_id, description = nil) ⇒ Object

Create a snapshot of an EBS volume and store it in S3

Parameters

  • volume_id<~String> - Id of EBS volume to snapshot

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘encrypted’<~Boolean>: The encryption status of the snapshot.

      • ‘progress’<~String> - The percentage progress of the snapshot

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

      • ‘snapshotId’<~String> - id of snapshot

      • ‘startTime’<~Time> - timestamp when snapshot was initiated

      • ‘status’<~String> - state of snapshot

      • ‘volumeId’<~String> - id of volume snapshot targets

Amazon API Reference



24
25
26
27
28
29
30
31
# File 'lib/fog/aws/requests/compute/create_snapshot.rb', line 24

def create_snapshot(volume_id, description = nil)
  request(
    'Action'      => 'CreateSnapshot',
    'Description' => description,
    'VolumeId'    => volume_id,
    :parser       => Fog::Parsers::AWS::Compute::CreateSnapshot.new
  )
end

#create_spot_datafeed_subscription(bucket, prefix) ⇒ Object

Create a spot datafeed subscription

Parameters

  • bucket<~String> - bucket name to store datafeed in

  • prefix<~String> - prefix to store data with

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘spotDatafeedSubscription’<~Hash>:

        • ‘bucket’<~String> - S3 bucket where data is stored

        • ‘fault’<~Hash>:

          • ‘code’<~String> - fault code

          • ‘reason’<~String> - fault reason

        • ‘ownerId’<~String> - AWS id of account owner

        • ‘prefix’<~String> - prefix for datafeed items

        • ‘state’<~String> - state of datafeed subscription

Amazon API Reference



27
28
29
30
31
32
33
34
35
# File 'lib/fog/aws/requests/compute/create_spot_datafeed_subscription.rb', line 27

def create_spot_datafeed_subscription(bucket, prefix)
  request(
    'Action'    => 'CreateSpotDatafeedSubscription',
    'Bucket'    => bucket,
    'Prefix'    => prefix,
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::SpotDatafeedSubscription.new
  )
end

#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

    • ‘mapPublicIpOnLaunch’<~Boolean> - Indicates whether instances launched in this subnet receive a public IPv4 address.

    • ‘defaultForAz’<~Boolean> - Indicates whether this is the default subnet for the Availability Zone.

Amazon API Reference



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

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

#create_tags(resources, tags) ⇒ Object

Adds tags to resources

Parameters

  • resources<~String> - One or more resources to tag

  • tags<~String> - hash of key value tag pairs to assign

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - success?

Amazon API Reference



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/fog/aws/requests/compute/create_tags.rb', line 20

def create_tags(resources, tags)
  resources = [*resources]
  for key, value in tags
    if value.nil?
      tags[key] = ''
    end
  end
  params = {}
  params.merge!(Fog::AWS.indexed_param('ResourceId', resources))
  params.merge!(Fog::AWS.indexed_param('Tag.%d.Key', tags.keys))
  params.merge!(Fog::AWS.indexed_param('Tag.%d.Value', tags.values))
  request({
    'Action'    => 'CreateTags',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::Basic.new
  }.merge!(params))
end

#create_volume(availability_zone, size, options = {}) ⇒ Object

Create an EBS volume

Parameters

  • availability_zone<~String> - availability zone to create volume in

  • size<~Integer> - Size in GiBs for volume. Must be between 1 and 1024.

  • options<~Hash>

    • ‘SnapshotId’<~String> - Optional, snapshot to create volume from

    • ‘VolumeType’<~String> - Optional, volume type. standard or io1, default is standard.

    • ‘Iops’<~Integer> - Number of IOPS the volume supports. Required if VolumeType is io1, must be between 1 and 4000.

    • ‘Encrypted’<~Boolean> - Optional, specifies whether the volume should be encrypted, default is false.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘availabilityZone’<~String> - Availability zone for volume

      • ‘createTime’<~Time> - Timestamp for creation

      • ‘size’<~Integer> - Size in GiBs for volume

      • ‘snapshotId’<~String> - Snapshot volume was created from, if any

      • ‘status’<~String> - State of volume

      • ‘volumeId’<~String> - Reference to volume

      • ‘volumeType’<~String> - Type of volume

      • ‘iops’<~Integer> - Number of IOPS the volume supports

      • ‘encrypted’<~Boolean> - Indicates whether the volume will be encrypted

Amazon API Reference



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/fog/aws/requests/compute/create_volume.rb', line 32

def create_volume(availability_zone, size, options = {})
  unless options.is_a?(Hash)
    Fog::Logger.deprecation("create_volume with a bare snapshot_id is deprecated, use create_volume(availability_zone, size, 'SnapshotId' => snapshot_id) instead [light_black](#{caller.first})[/]")
    options = { 'SnapshotId' => options }
  end

  request({
    'Action'            => 'CreateVolume',
    'AvailabilityZone'  => availability_zone,
    'Size'              => size,
    :parser             => Fog::Parsers::AWS::Compute::CreateVolume.new
  }.merge(options))
end

#create_vpc(cidrBlock, options = {}) ⇒ Object

Creates a VPC with the CIDR block you specify.

Parameters

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

  • options<~Hash>:

    • InstanceTenancy<~String> - The allowed tenancy of instances launched into the VPC. A value of default means instances can be launched with any tenancy; a value of dedicated means instances must be launched with tenancy as dedicated.

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘vpc’<~Array>:

  • ‘vpcId’<~String> - The VPC’s ID

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

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

  • ‘dhcpOptionsId’<~String> - The ID of the set of DHCP options.

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

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

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

Amazon API Reference



29
30
31
32
33
34
35
# File 'lib/fog/aws/requests/compute/create_vpc.rb', line 29

def create_vpc(cidrBlock, options = {})
  request({
    'Action' => 'CreateVpc',
    'CidrBlock' => cidrBlock,
    :parser => Fog::Parsers::AWS::Compute::CreateVpc.new
  }.merge!(options))
end

#delete_dhcp_options(dhcp_options_id) ⇒ Object

Deletes a set of DHCP options that you specify. Amazon VPC returns an error if the set of options you specify is currently associated with a VPC. You can disassociate the set of options by associating either a new set of options or the default options with the VPC.

Parameters

  • dhcp_options_id<~String> - The ID of the DHCP options set you want to delete.

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘return’<~Boolean> - Returns true if the request succeeds.

Amazon API Reference



20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/compute/delete_dhcp_options.rb', line 20

def delete_dhcp_options(dhcp_options_id)
  request(
    'Action' => 'DeleteDhcpOptions',
    'DhcpOptionsId' => dhcp_options_id,
    :parser => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#delete_internet_gateway(internet_gateway_id) ⇒ Object

Deletes an Internet gateway from your AWS account. The gateway must not be attached to a VPC

Parameters

  • internet_gateway_id<~String> - The ID of the InternetGateway you want to delete.

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘return’<~Boolean> - Returns true if the request succeeds.

Amazon API Reference



18
19
20
21
22
23
24
# File 'lib/fog/aws/requests/compute/delete_internet_gateway.rb', line 18

def delete_internet_gateway(internet_gateway_id)
  request(
    'Action' => 'DeleteInternetGateway',
    'InternetGatewayId' => internet_gateway_id,
    :parser => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#delete_key_pair(key_name) ⇒ Object

Delete a key pair that you own

Parameters

  • key_name<~String> - Name of the key pair.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘requestId’<~String> id of request

      • ‘return’<~Boolean> - success?

Amazon API Reference



19
20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/compute/delete_key_pair.rb', line 19

def delete_key_pair(key_name)
  request(
    'Action'    => 'DeleteKeyPair',
    'KeyName'   => key_name,
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#delete_network_acl(network_acl_id) ⇒ Object

Deletes a network ACL.

Parameters

  • network_acl_id<~String> - The ID of the network ACL you want to delete.

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘return’<~Boolean> - Returns true if the request succeeds.

Amazon API Reference



19
20
21
22
23
24
25
# File 'lib/fog/aws/requests/compute/delete_network_acl.rb', line 19

def delete_network_acl(network_acl_id)
  request(
    'Action'       => 'DeleteNetworkAcl',
    'NetworkAclId' => network_acl_id,
    :parser        => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#delete_network_acl_entry(network_acl_id, rule_number, egress) ⇒ Object

Deletes a network ACL entry

Parameters

  • network_acl_id<~String> - The ID of the network ACL

  • rule_number<~Integer> - The rule number of the entry to delete.

  • egress<~Boolean> - Indicates whether the rule is an egress rule (true) or ingress rule (false)

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘return’<~Boolean> - Returns true if the request succeeds.

Amazon API Reference



21
22
23
24
25
26
27
28
29
# File 'lib/fog/aws/requests/compute/delete_network_acl_entry.rb', line 21

def delete_network_acl_entry(network_acl_id, rule_number, egress)
  request(
    'Action'       => 'DeleteNetworkAclEntry',
    'NetworkAclId' => network_acl_id,
    'RuleNumber'   => rule_number,
    'Egress'       => egress,
    :parser        => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#delete_network_interface(network_interface_id) ⇒ Object

Deletes a network interface.

Parameters

  • network_interface_id<~String> - The ID of the network interface you want to delete.

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘return’<~Boolean> - Returns true if the request succeeds.

Amazon API Reference



18
19
20
21
22
23
24
# File 'lib/fog/aws/requests/compute/delete_network_interface.rb', line 18

def delete_network_interface(network_interface_id)
  request(
    'Action'             => 'DeleteNetworkInterface',
    'NetworkInterfaceId' => network_interface_id,
    :parser => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#delete_placement_group(name) ⇒ Object

Delete a placement group that you own

Parameters

  • group_name<~String> - Name of the placement group.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - success?

Amazon API Reference



19
20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/compute/delete_placement_group.rb', line 19

def delete_placement_group(name)
  request(
    'Action'    => 'DeletePlacementGroup',
    'GroupName' => name,
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#delete_route(route_table_id, destination_cidr_block) ⇒ Object

Deletes the specified route from the specified route table.

Parameters

  • RouteTableId<~String> - The ID of the route table.

  • DestinationCidrBlock<~String> - The CIDR range for the route. The value you specify must match the CIDR for the route exactly.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘requestId’<~String> - The ID of the request.

      • ‘return’<~Boolean> - Returns true if the request succeeds. Otherwise, returns an error.

Amazon API Reference



20
21
22
23
24
25
26
27
# File 'lib/fog/aws/requests/compute/delete_route.rb', line 20

def delete_route(route_table_id, destination_cidr_block)
  request(
    'Action'                => 'DeleteRoute',
    'RouteTableId'          => route_table_id,
    'DestinationCidrBlock'  => destination_cidr_block,
    :parser                 => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#delete_route_table(route_table_id) ⇒ Object

Deletes the specified route table.

Parameters

  • RouteTableId<~String> - The ID of the route table.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘requestId’<~String> - The ID of request.

      • ‘return’<~Boolean> - Returns true if the request succeeds. Otherwise, returns an error.

Amazon API Reference



19
20
21
22
23
24
25
# File 'lib/fog/aws/requests/compute/delete_route_table.rb', line 19

def delete_route_table(route_table_id)
  request(
    'Action'    => 'DeleteRouteTable',
    'RouteTableId'  => route_table_id,
    :parser     => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#delete_security_group(name, id = nil) ⇒ Object

Delete a security group that you own

Parameters

  • group_name<~String> - Name of the security group, must be nil if id is specified

  • group_id<~String> - Id of the security group, must be nil if name is specified

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - success?

Amazon API Reference



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/fog/aws/requests/compute/delete_security_group.rb', line 20

def delete_security_group(name, id = nil)
  if name && id
    raise Fog::AWS::Compute::Error.new("May not specify both group_name and group_id")
  end
  if name
    type_id    = 'GroupName'
    identifier = name
  else
    type_id    = 'GroupId'
    identifier = id
  end
  request(
    'Action'    => 'DeleteSecurityGroup',
    type_id     => identifier,
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#delete_snapshot(snapshot_id) ⇒ Object

Delete a snapshot of an EBS volume that you own

Parameters

  • snapshot_id<~String> - ID of snapshot to delete

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - success?

Amazon API Reference



19
20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/compute/delete_snapshot.rb', line 19

def delete_snapshot(snapshot_id)
  request(
    'Action'      => 'DeleteSnapshot',
    'SnapshotId'  => snapshot_id,
    :idempotent   => true,
    :parser       => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#delete_spot_datafeed_subscriptionObject

Delete a spot datafeed subscription

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘requestId’<~String> id of request

      • ‘return’<~Boolean> - success?

Amazon API Reference



16
17
18
19
20
21
22
# File 'lib/fog/aws/requests/compute/delete_spot_datafeed_subscription.rb', line 16

def delete_spot_datafeed_subscription
  request(
    'Action'    => 'DeleteSpotDatafeedSubscription',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#delete_subnet(subnet_id) ⇒ Object

Deletes a subnet from a VPC. You must terminate all running instances in the subnet before deleting it, otherwise Amazon VPC returns an error

Parameters

  • subnet_id<~String> - The ID of the Subnet you want to delete.

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘return’<~Boolean> - Returns true if the request succeeds.

Amazon API Reference



19
20
21
22
23
24
25
# File 'lib/fog/aws/requests/compute/delete_subnet.rb', line 19

def delete_subnet(subnet_id)
  request(
    'Action' => 'DeleteSubnet',
    'SubnetId' => subnet_id,
    :parser => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#delete_tags(resources, tags) ⇒ Object

Remove tags from resources

Parameters

  • resources<~String> - One or more resources to remove tags from

  • tags<~String> - hash of key value tag pairs to remove

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - success?

Amazon API Reference



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/fog/aws/requests/compute/delete_tags.rb', line 20

def delete_tags(resources, tags)
  resources = [*resources]
  params = {}
  params.merge!(Fog::AWS.indexed_param('ResourceId', resources))

  # can not rely on indexed_param because nil values should be omitted
  tags.keys.each_with_index do |key, index|
    index += 1 # should start at 1 instead of 0
    params.merge!("Tag.#{index}.Key" => key)
    unless tags[key].nil?
      params.merge!("Tag.#{index}.Value" => tags[key])
    end
  end

  request({
    'Action'            => 'DeleteTags',
    :parser             => Fog::Parsers::AWS::Compute::Basic.new
  }.merge!(params))
end

#delete_volume(volume_id) ⇒ Object

Delete an EBS volume

Parameters

  • volume_id<~String> - Id of volume to delete.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - success?

Amazon API Reference



19
20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/compute/delete_volume.rb', line 19

def delete_volume(volume_id)
  request(
    'Action'    => 'DeleteVolume',
    'VolumeId'  => volume_id,
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#delete_vpc(vpc_id) ⇒ Object

Deletes a VPC. You must detach or delete all gateways or other objects that are dependent on the VPC first. For example, you must terminate all running instances, delete all VPC security groups (except the default), delete all the route tables (except the default), etc.

Parameters

  • vpc_id<~String> - The ID of the VPC you want to delete.

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘return’<~Boolean> - Returns true if the request succeeds.

Amazon API Reference



22
23
24
25
26
27
28
# File 'lib/fog/aws/requests/compute/delete_vpc.rb', line 22

def delete_vpc(vpc_id)
  request(
    'Action' => 'DeleteVpc',
    'VpcId' => vpc_id,
    :parser => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#deregister_image(image_id) ⇒ Object

deregister an image

Parameters

  • image_id<~String> - Id of image to deregister

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘return’<~Boolean> - Returns true if deregistration succeeded

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

Amazon API Reference



19
20
21
22
23
24
25
# File 'lib/fog/aws/requests/compute/deregister_image.rb', line 19

def deregister_image(image_id)
  request(
    'Action'      => 'DeregisterImage',
    'ImageId'     => image_id,
    :parser       => Fog::Parsers::AWS::Compute::DeregisterImage.new
  )
end

#describe_account_attributes(filters = {}) ⇒ Object

Describe account attributes

Parameters

  • filters<~Hash> - List of filters to limit results with

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘accountAttributeSet’<~Array>:

        • ‘attributeName’<~String> - supported-platforms

        • ‘attributeValueSet’<~Array>:

          • ‘attributeValue’<~String> - Value of attribute

Amazon API Reference



23
24
25
26
27
28
29
30
# File 'lib/fog/aws/requests/compute/describe_account_attributes.rb', line 23

def (filters = {})
  params = Fog::AWS.indexed_filters(filters)
  request({
    'Action'    => 'DescribeAccountAttributes',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DescribeAccountAttributes.new
  }.merge!(params))
end

#describe_addresses(filters = {}) ⇒ Object

Describe all or specified IP addresses.

Parameters

  • filters<~Hash> - List of filters to limit results with

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘addressesSet’<~Array>:

        • ‘instanceId’<~String> - instance for ip address

        • ‘publicIp’<~String> - ip address for instance

Amazon API Reference



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fog/aws/requests/compute/describe_addresses.rb', line 21

def describe_addresses(filters = {})
  unless filters.is_a?(Hash)
    Fog::Logger.deprecation("describe_addresses with #{filters.class} param is deprecated, use describe_addresses('public-ip' => []) instead [light_black](#{caller.first})[/]")
    filters = {'public-ip' => [*filters]}
  end
  params = Fog::AWS.indexed_filters(filters)
  request({
    'Action'    => 'DescribeAddresses',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DescribeAddresses.new
  }.merge!(params))
end

#describe_availability_zones(filters = {}) ⇒ Object

Describe all or specified availability zones

Params

  • filters<~Hash> - List of filters to limit results with

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘availabilityZoneInfo’<~Array>:

        • ‘regionName’<~String> - Name of region

        • ‘zoneName’<~String> - Name of zone

        • ‘zoneState’<~String> - State of zone

Amazon API Reference



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fog/aws/requests/compute/describe_availability_zones.rb', line 22

def describe_availability_zones(filters = {})
  unless filters.is_a?(Hash)
    Fog::Logger.deprecation("describe_availability_zones with #{filters.class} param is deprecated, use describe_availability_zones('zone-name' => []) instead [light_black](#{caller.first})[/]")
    filters = {'zone-name' => [*filters]}
  end
  params = Fog::AWS.indexed_filters(filters)
  request({
    'Action'    => 'DescribeAvailabilityZones',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DescribeAvailabilityZones.new
  }.merge!(params))
end

Describes one or more of your linked EC2-Classic instances. This request only returns information about EC2-Classic instances linked to a VPC through ClassicLink; you cannot use this request to return information about other instances.

Parameters

  • options<~Hash>

    • instance_ids<~Array> - An array of instance ids to restruct the results to

    • filters<~Hash> - Filters to restrict the results to. Recognises vpc-id, group-id, instance-id in addition

      to tag-key, tag-value and tag:key
      
    • max_results

    • next_token

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘instancesSet’<~Array> - array of ClassicLinkInstance

    • ‘vpcId’<~String>

    • ‘instanceId’<~String>

    • ‘tagSet’<~Hash>

    • ‘groups’<~Array>

      • groupId <~String>

      • groupName <~String>

(Amazon API Reference)[docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeClassicLinkInstances.html



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/fog/aws/requests/compute/describe_classic_link_instances.rb', line 27

def describe_classic_link_instances(options={})
  params = {}
  params['MaxResults'] = options[:max_results] if options[:max_results]
  params['NextToken'] = options[:next_token] if options[:next_token]
  params.merge!(Fog::AWS.indexed_param('InstanceId', options[:instance_ids])) if options[:instance_ids]
  params.merge!(Fog::AWS.indexed_filters(options[:filters])) if options[:filters]
  request({
    'Action'    => 'DescribeClassicLinkInstances',
    :parser     => Fog::Parsers::AWS::Compute::DescribeClassicLinkInstances.new
  }.merge(params))
end

#describe_dhcp_options(filters = {}) ⇒ Object

Describe all or specified dhcp_options

Parameters

  • filters<~Hash> - List of filters to limit results with

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘DhcpOptionsSet’<~Array>:

    • ‘dhcpOptionsId’<~String> - The ID of the Dhcp Options

    • ‘dhcpConfigurationSet’<~Array>: - The list of options in the set.

      • ‘key’<~String> - The name of a DHCP option.

      • ‘valueSet’<~Array>: A set of values for a DHCP option.

        • ‘value’<~String> - The value of a DHCP option.

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

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

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

Amazon API Reference



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/fog/aws/requests/compute/describe_dhcp_options.rb', line 27

def describe_dhcp_options(filters = {})
  unless filters.is_a?(Hash)
    Fog::Logger.warning("describe_dhcp_options with #{filters.class} param is deprecated, use dhcp_options('dhcp-options-id' => []) instead [light_black](#{caller.first})[/]")
    filters = {'dhcp-options-id' => [*filters]}
  end
  params = Fog::AWS.indexed_filters(filters)
  request({
    'Action' => 'DescribeDhcpOptions',
    :idempotent => true,
    :parser => Fog::Parsers::AWS::Compute::DescribeDhcpOptions.new
  }.merge!(params))
end

#describe_image_attribute(image_id, attribute) ⇒ Object

Describes an image attribute value

Parameters

  • image_id<~String> - The ID of the image you want to describe an attribute of

  • attribute<~String> - The attribute to describe, must be one of the following:

    -'description'
    -'kernel'
    -'ramdisk'
    -'launchPermission'
    -'productCodes'
    -'blockDeviceMapping'
    -'sriovNetSupport'
    

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘description’<~String> - The description for the AMI

  • ‘imageId’<~String> - The ID of the image

  • ‘kernelId’<~String> - The kernel ID

  • ‘ramdiskId’<~String> - The RAM disk ID

  • ‘blockDeviceMapping’<~List> - The block device mapping of the image

  • ‘productCodes’<~List> - A list of product codes

  • ‘sriovNetSupport’<~String> - The value to use for a resource attribute

(Amazon API Reference)



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

def describe_image_attribute(image_id, attribute)
  request(
    'Action'       => 'DescribeImageAttribute',
    'ImageId'   => image_id,
    'Attribute'    => attribute,
    :parser        => Fog::Parsers::AWS::Compute::DescribeImageAttribute.new
  )
end

#describe_images(filters = {}) ⇒ Object

Describe all or specified images.

Params

  • filters<~Hash> - List of filters to limit results with

    • filters and/or the following

    • ‘ExecutableBy’<~String> - Only return images that the executable_by user has explicit permission to launch

    • ‘ImageId’<~Array> - Ids of images to describe

    • ‘Owner’<~String> - Only return images belonging to owner.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘imagesSet’<~Array>:

        • ‘architecture’<~String> - Architecture of the image

        • ‘blockDeviceMapping’<~Array> - An array of mapped block devices

        • ‘description’<~String> - Description of image

        • ‘imageId’<~String> - Id of the image

        • ‘imageLocation’<~String> - Location of the image

        • ‘imageOwnerAlias’<~String> - Alias of the owner of the image

        • ‘imageOwnerId’<~String> - Id of the owner of the image

        • ‘imageState’<~String> - State of the image

        • ‘imageType’<~String> - Type of the image

        • ‘isPublic’<~Boolean> - Whether or not the image is public

        • ‘kernelId’<~String> - Kernel id associated with image, if any

        • ‘platform’<~String> - Operating platform of the image

        • ‘productCodes’<~Array> - Product codes for the image

        • ‘ramdiskId’<~String> - Ramdisk id associated with image, if any

        • ‘rootDeviceName’<~String> - Root device name, e.g. /dev/sda1

        • ‘rootDeviceType’<~String> - Root device type, ebs or instance-store

        • ‘virtualizationType’<~String> - Type of virtualization

        • ‘creationDate’time<~Datetime> - Date and time the image was created

        • ‘enaSupport’<~Boolean> - whether or not the image supports enhanced networking

Amazon API Reference



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/fog/aws/requests/compute/describe_images.rb', line 43

def describe_images(filters = {})
  options = {}
  for key in ['ExecutableBy', 'ImageId', 'Owner']
    if filters.is_a?(Hash) && filters.key?(key)
      options.merge!(Fog::AWS.indexed_request_param(key, filters.delete(key)))
    end
  end
  params = Fog::AWS.indexed_filters(filters).merge!(options)
  request({
    'Action'    => 'DescribeImages',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DescribeImages.new
  }.merge!(params))
end

#describe_instance_attribute(instance_id, attribute) ⇒ Object

Describes an instance attribute value

Parameters

  • instance_id<~String> - The ID of the instance you want to describe an attribute of

  • attribute<~String> - The attribute to describe, must be one of the following:

    -'instanceType'
    -'kernel'
    -'ramdisk'
    -'userData'
    -'disableApiTermination'
    -'instanceInitiatedShutdownBehavior'
    -'rootDeviceName'
    -'blockDeviceMapping'
    -'productCodes'
    -'sourceDestCheck'
    -'groupSet'
    -'ebsOptimized'
    -'sriovNetSupport'
    

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘instanceId’<~String> - The ID of the instance

  • ‘instanceType’<~String> - Instance type

  • ‘kernelId’<~String> - The kernel ID

  • ‘ramdiskId’<~String> - The RAM disk ID

  • ‘userData’<~String> - The Base64-encoded MIME user data

  • ‘disableApiTermination’<~Boolean> - If the value is true , you can’t terminate the instance through the Amazon EC2 console, CLI, or API; otherwise, you can.

  • ‘instanceInitiatedShutdownBehavior’<~String> - Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown)

  • ‘rootDeviceName’<~String> - The name of the root device (for example, /dev/sda1 or /dev/xvda )

  • ‘blockDeviceMapping’<~List> - The block device mapping of the instance

  • ‘productCodes’<~List> - A list of product codes

  • ‘ebsOptimized’<~Boolean> - Indicates whether the instance is optimized for EBS I/O

  • ‘sriovNetSupport’<~String> - The value to use for a resource attribute

  • ‘sourceDestCheck’<~Boolean> - Indicates whether source/destination checking is enabled. A value of true means checking is enabled, and false means checking is disabled. This value must be false for a NAT instance to perform NAT

  • ‘groupSet’<~List> - The security groups associated with the instance

(Amazon API Reference)



44
45
46
47
48
49
50
51
# File 'lib/fog/aws/requests/compute/describe_instance_attribute.rb', line 44

def describe_instance_attribute(instance_id, attribute)
  request(
    'Action'       => 'DescribeInstanceAttribute',
    'InstanceId'   => instance_id,
    'Attribute'    => attribute,
    :parser        => Fog::Parsers::AWS::Compute::DescribeInstanceAttribute.new
  )
end

#describe_instance_status(filters = {}) ⇒ Object

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fog/aws/requests/compute/describe_instance_status.rb', line 9

def describe_instance_status(filters = {})
  raise ArgumentError.new("Filters must be a hash, but is a #{filters.class}.") unless filters.is_a?(Hash)
  next_token = filters.delete('nextToken') || filters.delete('NextToken')
  max_results = filters.delete('maxResults') || filters.delete('MaxResults')
  all_instances = filters.delete('includeAllInstances') || filters.delete('IncludeAllInstances')

  params = Fog::AWS.indexed_request_param('InstanceId', filters.delete('InstanceId'))

  params.merge!(Fog::AWS.indexed_filters(filters))

  params['NextToken'] = next_token if next_token
  params['MaxResults'] = max_results if max_results
  params['IncludeAllInstances'] = all_instances if all_instances

  request({
    'Action'    => 'DescribeInstanceStatus',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DescribeInstanceStatus.new
  }.merge!(params))
end

#describe_instances(filters = {}) ⇒ Object

Describe all or specified instances

Parameters

  • filters<~Hash> - List of filters to limit results with

    • Also allows for passing of optional parameters to fetch instances in batches:

      • ‘maxResults’ - The number of instances to return for the request

      • ‘nextToken’ - The token to fetch the next set of items. This is returned by a previous request.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘nextToken’ - The token to use when requesting the next set of items when fetching items in batches.

      • ‘reservationSet’<~Array>:

        • ‘groupSet’<~Array> - Group names for reservation

        • ‘ownerId’<~String> - AWS Access Key ID of reservation owner

        • ‘reservationId’<~String> - Id of the reservation

        • ‘instancesSet’<~Array>:

          • instance<~Hash>:

            • ‘architecture’<~String> - architecture of image in [i386, x86_64]

            • ‘amiLaunchIndex’<~Integer> - reference to instance in launch group

            • ‘blockDeviceMapping’<~Array>

              • ‘attachTime’<~Time> - time of volume attachment

              • ‘deleteOnTermination’<~Boolean> - whether or not to delete volume on termination

              • ‘deviceName’<~String> - specifies how volume is exposed to instance

              • ‘status’<~String> - status of attached volume

              • ‘volumeId’<~String> - Id of attached volume

            • ‘dnsName’<~String> - public dns name, blank until instance is running

            • ‘ebsOptimized’<~Boolean> - Whether the instance is optimized for EBS I/O

            • ‘imageId’<~String> - image id of ami used to launch instance

            • ‘instanceId’<~String> - id of the instance

            • ‘instanceState’<~Hash>:

              • ‘code’<~Integer> - current status code

              • ‘name’<~String> - current status name

            • ‘instanceType’<~String> - type of instance

            • ‘ipAddress’<~String> - public ip address assigned to instance

            • ‘kernelId’<~String> - id of kernel used to launch instance

            • ‘keyName’<~String> - name of key used launch instances or blank

            • ‘launchTime’<~Time> - time instance was launched

            • ‘monitoring’<~Hash>:

              • ‘state’<~Boolean - state of monitoring

            • ‘placement’<~Hash>:

              • ‘availabilityZone’<~String> - Availability zone of the instance

            • ‘platform’<~String> - Platform of the instance (e.g., Windows).

            • ‘productCodes’<~Array> - Product codes for the instance

            • ‘privateDnsName’<~String> - private dns name, blank until instance is running

            • ‘privateIpAddress’<~String> - private ip address assigned to instance

            • ‘rootDeviceName’<~String> - specifies how the root device is exposed to the instance

            • ‘rootDeviceType’<~String> - root device type used by AMI in [ebs, instance-store]

            • ‘ramdiskId’<~String> - Id of ramdisk used to launch instance

            • ‘reason’<~String> - reason for most recent state transition, or blank

Amazon API Reference



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/fog/aws/requests/compute/describe_instances.rb', line 59

def describe_instances(filters = {})
  unless filters.is_a?(Hash)
    Fog::Logger.deprecation("describe_instances with #{filters.class} param is deprecated, use describe_instances('instance-id' => []) instead [light_black](#{caller.first})[/]")
    filters = {'instance-id' => [*filters]}
  end
  params = {}

  next_token  = filters.delete('nextToken') || filters.delete('NextToken')
  max_results = filters.delete('maxResults') || filters.delete('MaxResults')

  if filters['instance-id']
    instance_ids = filters.delete('instance-id')
    instance_ids = [instance_ids] unless instance_ids.is_a?(Array)
    instance_ids.each_with_index do |id, index|
      params.merge!("InstanceId.#{index}" => id)
    end
  end

  params['NextToken']  = next_token if next_token
  params['MaxResults'] = max_results if max_results
  params.merge!(Fog::AWS.indexed_filters(filters))

  request({
    'Action'    => 'DescribeInstances',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DescribeInstances.new
  }.merge!(params))
end

#describe_internet_gateways(filters = {}) ⇒ Object

Describe all or specified internet_gateways

Parameters

  • filters<~Hash> - List of filters to limit results with

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘InternetGatewaySet’<~Array>:

    • ‘internetGatewayId’<~String> - The ID of the Internet gateway.

    • ‘attachmentSet’<~Array>: - A list of VPCs attached to the Internet gateway

      • ‘vpcId’<~String> - The ID of the VPC the Internet gateway is attached to

      • ‘state’<~String> - The current state of the attachment

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

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

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

Amazon API Reference



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/fog/aws/requests/compute/describe_internet_gateways.rb', line 26

def describe_internet_gateways(filters = {})
  unless filters.is_a?(Hash)
    Fog::Logger.warning("describe_internet_gateways with #{filters.class} param is deprecated, use internet_gateways('internet-gateway-id' => []) instead [light_black](#{caller.first})[/]")
    filters = {'internet-gateway-id' => [*filters]}
  end
  params = Fog::AWS.indexed_filters(filters)
  request({
    'Action' => 'DescribeInternetGateways',
    :idempotent => true,
    :parser => Fog::Parsers::AWS::Compute::DescribeInternetGateways.new
  }.merge!(params))
end

#describe_key_pairs(filters = {}) ⇒ Object

Describe all or specified key pairs

Parameters

  • filters<~Hash> - List of filters to limit results with

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘keySet’<~Array>:

        • ‘keyName’<~String> - Name of key

        • ‘keyFingerprint’<~String> - Fingerprint of key

Amazon API Reference



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fog/aws/requests/compute/describe_key_pairs.rb', line 21

def describe_key_pairs(filters = {})
  unless filters.is_a?(Hash)
    Fog::Logger.deprecation("describe_key_pairs with #{filters.class} param is deprecated, use describe_key_pairs('key-name' => []) instead [light_black](#{caller.first})[/]")
    filters = {'key-name' => [*filters]}
  end
  params = Fog::AWS.indexed_filters(filters)
  request({
    'Action'    => 'DescribeKeyPairs',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DescribeKeyPairs.new
  }.merge!(params))
end

#describe_network_acls(filters = {}) ⇒ Object

Describe all or specified network ACLs

Parameters

  • filters<~Hash> - List of filters to limit results with

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘networkAclSet’<~Array>: - A list of network ACLs

  • ‘networkAclId’<~String> - The ID of the network ACL

  • ‘vpcId’<~String> - The ID of the VPC for the network ACL

  • ‘default’<~Boolean> - Indicates whether this is the default network ACL for the VPC

  • ‘entrySet’<~Array>: - A list of entries (rules) in the network ACL

  • ‘ruleNumber’<~Integer> - The rule number for the entry. ACL entries are processed in ascending order by rule number

  • ‘protocol’<~Integer> - The protocol. A value of -1 means all protocols

  • ‘ruleAction’<~String> - Indicates whether to allow or deny the traffic that matches the rule

  • ‘egress’<~Boolean> - Indicates whether the rule is an egress rule (applied to traffic leaving the subnet)

  • ‘cidrBlock’<~String> - The network range to allow or deny, in CIDR notation

  • ‘icmpTypeCode’<~Hash> - ICMP protocol: The ICMP type and code

  • ‘code’<~Integer> - The ICMP code. A value of -1 means all codes for the specified ICMP type

  • ‘type’<~Integer> - The ICMP type. A value of -1 means all types

  • ‘portRange’<~Hash> - TCP or UDP protocols: The range of ports the rule applies to

  • ‘from’<~Integer> - The first port in the range

  • ‘to’<~Integer> - The last port in the range

  • ‘associationSet’<~Array>: - A list of associations between the network ACL and subnets

  • ‘networkAclAssociationId’<~String> - The ID of the association

  • ‘networkAclId’<~String> - The ID of the network ACL

  • ‘subnetId’<~String> - The ID of the subnet

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

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

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

Amazon API Reference



41
42
43
44
45
46
47
48
# File 'lib/fog/aws/requests/compute/describe_network_acls.rb', line 41

def describe_network_acls(filters = {})
  params = Fog::AWS.indexed_filters(filters)
  request({
    'Action' => 'DescribeNetworkAcls',
    :idempotent => true,
    :parser => Fog::Parsers::AWS::Compute::DescribeNetworkAcls.new
  }.merge!(params))
end

#describe_network_interface_attribute(network_interface_id, attribute) ⇒ Object

Describes a network interface attribute value

Parameters

  • network_interface_id<~String> - The ID of the network interface you want to describe an attribute of

  • attribute<~String> - The attribute to describe, must be one of ‘description’, ‘groupSet’, ‘sourceDestCheck’ or ‘attachment’

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘networkInterfaceId’<~String> - The ID of the network interface

  • ‘description’<~String> - The description (if requested)

  • ‘groupSet’<~Hash> - Associated security groups (if requested)

  • ‘key’<~String> - ID of associated group

  • ‘value’<~String> - Name of associated group

  • ‘sourceDestCheck’<~Boolean> - Flag indicating whether traffic to or from the instance is validated (if requested)

  • ‘attachment’<~Hash>: - Describes the way this nic is attached (if requested)

  • ‘attachmentID’<~String>

  • ‘instanceID’<~String>

  • ‘instanceOwnerId’<~String>

  • ‘deviceIndex’<~Integer>

  • ‘status’<~String>

  • ‘attachTime’<~String>

  • ‘deleteOnTermination<~Boolean>

Amazon API Reference



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

def describe_network_interface_attribute(network_interface_id, attribute)
  request(
    'Action'             => 'DescribeNetworkInterfaceAttribute',
    'NetworkInterfaceId' => network_interface_id,
    'Attribute'          => attribute,
    :parser              => Fog::Parsers::AWS::Compute::DescribeNetworkInterfaceAttribute.new
  )
end

#describe_network_interfaces(filters = {}) ⇒ Object

Describe all or specified network interfaces

Parameters

  • filters<~Hash> - List of filters to limit results with

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘networkInterfaceSet’<~Array>:

  • ‘networkInterfaceId’<~String> - The ID of the network interface

  • ‘subnetId’<~String> - The ID of the subnet

  • ‘vpcId’<~String> - The ID of the VPC

  • ‘availabilityZone’<~String> - The availability zone

  • ‘description’<~String> - The description

  • ‘ownerId’<~String> - The ID of the person who created the interface

  • ‘requesterId’<~String> - The ID of the entity requesting this interface

  • ‘requesterManaged’<~String> -

  • ‘status’<~String> - “available” or “in-use”

  • ‘macAddress’<~String> -

  • ‘privateIpAddress’<~String> - IP address of the interface within the subnet

  • ‘privateDnsName’<~String> - The private DNS name

  • ‘sourceDestCheck’<~Boolean> - Flag indicating whether traffic to or from the instance is validated

  • ‘groupSet’<~Hash> - Associated security groups

  • ‘key’<~String> - ID of associated group

  • ‘value’<~String> - Name of associated group

  • ‘attachment’<~Hash>: - Describes the way this nic is attached

  • ‘attachmentID’<~String>

  • ‘instanceID’<~String>

  • ‘instanceOwnerId’<~String>

  • ‘deviceIndex’<~Integer>

  • ‘status’<~String>

  • ‘attachTime’<~String>

  • ‘deleteOnTermination’<~Boolean>

  • ‘association’<~Hash>: - Describes an eventual instance association

  • ‘attachmentID’<~String> - ID of the network interface attachment

  • ‘instanceID’<~String> - ID of the instance attached to the network interface

  • ‘publicIp’<~String> - Address of the Elastic IP address bound to the network interface

  • ‘ipOwnerId’<~String> - ID of the Elastic IP address owner

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

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

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

  • ‘privateIpAddresses’ <~Array>:

  • ‘privateIpAddress’<~String> - One of the additional private ip address

  • ‘privateDnsName’<~String> - The private DNS associate to the ip address

  • ‘primary’<~String> - Whether main ip associate with NIC true of false

Amazon API Reference



55
56
57
58
59
60
61
62
# File 'lib/fog/aws/requests/compute/describe_network_interfaces.rb', line 55

def describe_network_interfaces(filters = {})
  params = Fog::AWS.indexed_filters(filters)
  request({
    'Action' => 'DescribeNetworkInterfaces',
    :idempotent => true,
    :parser => Fog::Parsers::AWS::Compute::DescribeNetworkInterfaces.new
  }.merge!(params))
end

#describe_placement_groups(filters = {}) ⇒ Object

Describe all or specified placement groups

Parameters

  • filters<~Hash> - List of filters to limit results with

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘placementGroupSet’<~Array>:

        • ‘groupName’<~String> - Name of placement group

        • ‘strategy’<~String> - Strategy of placement group

        • ‘state’<~String> - State of placement group

Amazon API Reference



22
23
24
25
26
27
28
29
# File 'lib/fog/aws/requests/compute/describe_placement_groups.rb', line 22

def describe_placement_groups(filters = {})
  params = Fog::AWS.indexed_filters(filters)
  request({
    'Action'    => 'DescribePlacementGroups',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DescribePlacementGroups.new
  }.merge!(params))
end

#describe_regions(filters = {}) ⇒ Object

Describe all or specified regions

Params

  • filters<~Hash> - List of filters to limit results with

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘regionInfo’<~Array>:

        • ‘regionName’<~String> - Name of region

        • ‘regionEndpoint’<~String> - Service endpoint for region

Amazon API Reference



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fog/aws/requests/compute/describe_regions.rb', line 21

def describe_regions(filters = {})
  unless filters.is_a?(Hash)
    Fog::Logger.deprecation("describe_regions with #{filters.class} param is deprecated, use describe_regions('region-name' => []) instead [light_black](#{caller.first})[/]")
    filters = {'region-name' => [*filters]}
  end
  params = Fog::AWS.indexed_filters(filters)
  request({
    'Action'    => 'DescribeRegions',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DescribeRegions.new
  }.merge!(params))
end

#describe_reserved_instances(filters = {}) ⇒ Object

Describe all or specified reserved instances

Parameters

  • filters<~Hash> - List of filters to limit results with

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘reservedInstancesSet’<~Array>:

        • ‘availabilityZone’<~String> - availability zone of the instance

        • ‘duration’<~Integer> - duration of reservation, in seconds

        • ‘fixedPrice’<~Float> - purchase price of reserved instance

        • ‘instanceType’<~String> - type of instance

        • ‘instanceCount’<~Integer> - number of reserved instances

        • ‘productDescription’<~String> - reserved instance description

        • ‘recurringCharges’<~Array>:

          • ‘frequency’<~String> - frequency of a recurring charge while the reservation is active (only Hourly at this time)

          • ‘amount’<~Float> - recurring charge amount

        • ‘reservedInstancesId’<~String> - id of the instance

        • ‘scope’<~String> - scope of the reservation (i.e. ‘Availability Zone’ or ‘Region’ - as of version 2016/11/15)

        • ‘start’<~Time> - start time for reservation

        • ‘state’<~String> - state of reserved instance purchase, in .[pending-payment, active, payment-failed, retired]

        • ‘usagePrice“<~Float> - usage price of reserved instances, per hour

        • ‘end’<~Time> - time reservation stopped being applied (i.e. sold or canceled - as of version 2013/10/01)

Amazon API Reference



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/fog/aws/requests/compute/describe_reserved_instances.rb', line 34

def describe_reserved_instances(filters = {})
  unless filters.is_a?(Hash)
    Fog::Logger.deprecation("describe_reserved_instances with #{filters.class} param is deprecated, use describe_reserved_instances('reserved-instances-id' => []) instead [light_black](#{caller.first})[/]")
    filters = {'reserved-instances-id' => [*filters]}
  end
  params = Fog::AWS.indexed_filters(filters)
  request({
    'Action'    => 'DescribeReservedInstances',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DescribeReservedInstances.new
  }.merge!(params))
end

#describe_reserved_instances_offerings(filters = {}) ⇒ Object

Describe all or specified reserved instances offerings

Parameters

  • filters<~Hash> - List of filters to limit results with

    • filters and/or the following

      • ‘AvailabilityZone’<~String> - availability zone of offering

      • ‘InstanceType’<~String> - instance type of offering

      • ‘InstanceTenancy’<~String> - tenancy of offering in [‘default’, ‘dedicated’]

      • ‘OfferingType’<~String> - type of offering, in [‘Heavy Utilization’, ‘Medium Utilization’, ‘Light Utilization’]

      • ‘ProductDescription’<~String> - description of offering, in [‘Linux/UNIX’, ‘Linux/UNIX (Amazon VPC)’, ‘Windows’, ‘Windows (Amazon VPC)’]

      • ‘MaxDuration’<~Integer> - maximum duration (in seconds) of offering

      • ‘MinDuration’<~Integer> - minimum duration (in seconds) of offering

      • ‘MaxResults’<~Integer> - The maximum number of results to return for the request in a single page

      • ‘NextToken’<~String> - The token to retrieve the next page of results

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘reservedInstancesOfferingsSet’<~Array>:

        • ‘availabilityZone’<~String> - availability zone of offering

        • ‘duration’<~Integer> - duration, in seconds, of offering

        • ‘fixedPrice’<~Float> - purchase price of offering

        • ‘includeMarketplace’<~Boolean> - whether or not to include marketplace offerings

        • ‘instanceType’<~String> - instance type of offering

        • ‘offeringType’<~String> - type of offering, in [‘Heavy Utilization’, ‘Medium Utilization’, ‘Light Utilization’]

        • ‘productDescription’<~String> - description of offering

        • ‘reservedInstancesOfferingId’<~String> - id of offering

        • ‘usagePrice’<~Float> - usage price of offering, per hour

      • ‘NextToken’<~String> - The token to retrieve the next page of results

Amazon API Reference



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/fog/aws/requests/compute/describe_reserved_instances_offerings.rb', line 39

def describe_reserved_instances_offerings(filters = {})
  options = {}
  for key in %w(AvailabilityZone InstanceType InstanceTenancy OfferingType ProductDescription MaxDuration MinDuration MaxResults NextToken)
    if filters.is_a?(Hash) && filters.key?(key)
      options[key] = filters.delete(key)
    end
  end
  params = Fog::AWS.indexed_filters(filters).merge!(options)
  request({
    'Action'    => 'DescribeReservedInstancesOfferings',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DescribeReservedInstancesOfferings.new
  }.merge!(params))
end

#describe_route_tables(filters = {}) ⇒ Object

Describe one or more of your route tables.

Parameters

  • RouteTableId<~String> - One or more route table IDs.

  • filters<~Hash> - List of filters to limit results with

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘requestId’<~String> - The ID of the request.

      • ‘routeTableSet’<~Array>:

        • ‘routeTableId’<~String> - The route table’s ID.

        • ‘vpcId’<~String> - The ID of the VPC for the route table.

        • ‘routeSet’<~Array>:

          • ‘destinationCidrBlock’<~String> - The CIDR address block used for the destination match.

          • ‘gatewayId’<~String> - The ID of a gateway attached to your VPC.

          • ‘instanceId’<~String> - The ID of a NAT instance in your VPC.

          • ‘instanceOwnerId’<~String> - The owner of the instance.

          • ‘networkInterfaceId’<~String> - The network interface ID.

          • ‘vpcPeeringConnectionId’<~String> - The peering connection ID.

          • ‘natGatewayId’<~String> - The ID of a NAT gateway attached to your VPC.

          • ‘state’<~String> - The state of the route. The blackhole state indicates that the route’s target isn’t available.

          • ‘origin’<~String> - Describes how the route was created.

        • ‘associationSet’<~Array>:

          • ‘RouteTableAssociationId’<~String> - An identifier representing the association between a route table and a subnet.

          • ‘routeTableId’<~String> - The ID of the route table.

          • ‘subnetId’<~String> - The ID of the subnet.

          • ‘main’<~Boolean> - Indicates whether this is the main route table.

        • ‘propagatingVgwSet’<~Array>:

          • ‘gatewayID’<~String> - The ID of the virtual private gateway (VGW).

        • ‘tagSet’<~Array>:

          • ‘key’<~String> - The tag key.

          • ‘value’<~String> - The tag value.

Amazon API Reference



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/fog/aws/requests/compute/describe_route_tables.rb', line 42

def describe_route_tables(filters = {})
  unless filters.is_a?(Hash)
    Fog::Logger.deprecation("describe_route_tables with #{filters.class} param is deprecated, use describe_route_tables('route-table-id' => []) instead [light_black](#{caller.first})[/]")
    filters = {'route-table-id' => [*filters]}
  end
  params = Fog::AWS.indexed_filters(filters)
  request({
    'Action'    => 'DescribeRouteTables',
    :parser     => Fog::Parsers::AWS::Compute::DescribeRouteTables.new
  }.merge!(params))
end

#describe_security_groups(filters = {}) ⇒ Object

Describe all or specified security groups

Parameters

  • filters<~Hash> - List of filters to limit results with

    • ‘MaxResults’<~Integer> - The maximum number of results to return for the request in a single page

    • ‘NextToken’<~String> - The token to retrieve the next page of results

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘securityGroupInfo’<~Array>:

        • ‘groupDescription’<~String> - Description of security group

        • ‘groupId’<~String> - ID of the security group.

        • ‘groupName’<~String> - Name of security group

        • ‘ipPermissions’<~Array>:

          • ‘fromPort’<~Integer> - Start of port range (or -1 for ICMP wildcard)

          • ‘groups’<~Array>:

            • ‘groupName’<~String> - Name of security group

            • ‘userId’<~String> - AWS User Id of account

          • ‘ipProtocol’<~String> - Ip protocol, must be in [‘tcp’, ‘udp’, ‘icmp’]

          • ‘ipRanges’<~Array>:

            • ‘cidrIp’<~String> - CIDR range

          • ‘ipv6Ranges’<~Array>:

            • ‘cidrIpv6’<~String> - CIDR ipv6 range

          • ‘toPort’<~Integer> - End of port range (or -1 for ICMP wildcard)

        • ‘ownerId’<~String> - AWS Access Key Id of the owner of the security group

      • ‘NextToken’<~String> - The token to retrieve the next page of results

Amazon API Reference



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/fog/aws/requests/compute/describe_security_groups.rb', line 37

def describe_security_groups(filters = {})
  unless filters.is_a?(Hash)
    Fog::Logger.deprecation("describe_security_groups with #{filters.class} param is deprecated, use describe_security_groups('group-name' => []) instead [light_black](#{caller.first})[/]")
    filters = {'group-name' => [*filters]}
  end

  options = {}
  for key in %w[MaxResults NextToken]
    if filters.is_a?(Hash) && filters.key?(key)
      options[key] = filters.delete(key)
    end
  end

  params = Fog::AWS.indexed_filters(filters).merge!(options)
  request({
    'Action'    => 'DescribeSecurityGroups',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DescribeSecurityGroups.new
  }.merge!(params))
end

#describe_snapshots(filters = {}, options = {}) ⇒ Object

Describe all or specified snapshots

Parameters

  • filters<~Hash> - List of filters to limit results with

  • options<~Hash>:

    • ‘Owner’<~String> - Owner of snapshot in [‘self’, ‘amazon’, account_id]

    • ‘RestorableBy’<~String> - Account id of user who can create volumes from this snapshot

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘snapshotSet’<~Array>:

        • ‘encrypted’<~Boolean>: The encryption status of the snapshot.

        • ‘progress’<~String>: The percentage progress of the snapshot

        • ‘snapshotId’<~String>: Id of the snapshot

        • ‘startTime’<~Time>: Timestamp of when snapshot was initiated

        • ‘status’<~String>: Snapshot state, in [‘pending’, ‘completed’]

        • ‘volumeId’<~String>: Id of volume that snapshot contains

Amazon API Reference



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/fog/aws/requests/compute/describe_snapshots.rb', line 28

def describe_snapshots(filters = {}, options = {})
  unless filters.is_a?(Hash)
    Fog::Logger.deprecation("describe_snapshots with #{filters.class} param is deprecated, use describe_snapshots('snapshot-id' => []) instead [light_black](#{caller.first})[/]")
    filters = {'snapshot-id' => [*filters]}
  end
  unless options.empty?
    Fog::Logger.deprecation("describe_snapshots with a second param is deprecated, use describe_snapshots(options) instead [light_black](#{caller.first})[/]")
  end

  for key in ['ExecutableBy', 'ImageId', 'Owner', 'RestorableBy']
    if filters.key?(key)
      options[key] = filters.delete(key)
    end
  end
  options['RestorableBy'] ||= 'self'
  params = Fog::AWS.indexed_filters(filters).merge!(options)
  request({
    'Action'    => 'DescribeSnapshots',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DescribeSnapshots.new
  }.merge!(params))
end

#describe_spot_datafeed_subscriptionObject

Describe spot datafeed subscription

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘spotDatafeedSubscription’<~Hash>:

        • ‘bucket’<~String> - S3 bucket where data is stored

        • ‘fault’<~Hash>:

          • ‘code’<~String> - fault code

          • ‘reason’<~String> - fault reason

        • ‘ownerId’<~String> - AWS id of account owner

        • ‘prefix’<~String> - prefix for datafeed items

        • ‘state’<~String> - state of datafeed subscription

Amazon API Reference



23
24
25
26
27
28
29
# File 'lib/fog/aws/requests/compute/describe_spot_datafeed_subscription.rb', line 23

def describe_spot_datafeed_subscription
  request({
    'Action'    => 'DescribeSpotDatafeedSubscription',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::SpotDatafeedSubscription.new
  })
end

#describe_spot_instance_requests(filters = {}) ⇒ Object

Describe all or specified spot instance requests

Parameters

  • filters<~Hash> - List of filters to limit results with

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘spotInstanceRequestSet’<~Array>:

        • ‘createTime’<~Time> - time of instance request creation

        • ‘instanceId’<~String> - instance id if one has been launched to fulfill request

        • ‘launchedAvailabilityZone’<~String> - availability zone of instance if one has been launched to fulfill request

        • ‘launchSpecification’<~Hash>:

          • ‘blockDeviceMapping’<~Hash> - list of block device mappings for instance

          • ‘groupSet’<~String> - security group(s) for instance

          • ‘keyName’<~String> - keypair name for instance

          • ‘imageId’<~String> - AMI for instance

          • ‘instanceType’<~String> - type for instance

          • ‘monitoring’<~Boolean> - monitoring status for instance

          • ‘subnetId’<~String> - VPC subnet ID for instance

        • ‘productDescription’<~String> - general description of AMI

        • ‘spotInstanceRequestId’<~String> - id of spot instance request

        • ‘spotPrice’<~Float> - maximum price for instances to be launched

        • ‘state’<~String> - spot instance request state

        • ‘type’<~String> - spot instance request type

Amazon API Reference



35
36
37
38
39
40
41
42
# File 'lib/fog/aws/requests/compute/describe_spot_instance_requests.rb', line 35

def describe_spot_instance_requests(filters = {})
  params = Fog::AWS.indexed_filters(filters)
  request({
    'Action'    => 'DescribeSpotInstanceRequests',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::SpotInstanceRequests.new
  }.merge!(params))
end

#describe_spot_price_history(filters = {}) ⇒ Object

Describe all or specified spot price history

Parameters

  • filters<~Hash> - List of filters to limit results with

    • filters and/or the following

      • ‘AvailabilityZone’<~String> - availability zone of offering

      • ‘InstanceType’<~Array> - instance types of offering

      • ‘ProductDescription’<~Array> - basic product descriptions

      • ‘StartTime’<~Time> - The date and time, up to the past 90 days, from which to start retrieving the price history data

      • ‘EndTime’<~Time> - The date and time, up to the current date, from which to stop retrieving the price history data

      • ‘MaxResults’<~Integer> - The maximum number of results to return for the request in a single page

      • ‘NextToken’<~String> - The token to retrieve the next page of results

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘spotPriceHistorySet’<~Array>:

        • ‘availabilityZone’<~String> - availability zone for instance

        • ‘instanceType’<~String> - the type of instance

        • ‘productDescription’<~String> - general description of AMI

        • ‘spotPrice’<~Float> - maximum price to launch one or more instances

        • ‘timestamp’<~Time> - date and time of request creation

      • ‘nextToken’<~String> - token to retrieve the next page of results

Amazon API Reference



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/fog/aws/requests/compute/describe_spot_price_history.rb', line 33

def describe_spot_price_history(filters = {})
  params = {}

  for key in %w(AvailabilityZone StartTime EndTime MaxResults NextToken)
    if filters.is_a?(Hash) && filters.key?(key)
      params[key] = filters.delete(key)
    end
  end

  if instance_types = filters.delete('InstanceType')
    params.merge!(Fog::AWS.indexed_param('InstanceType', [*instance_types]))
  end

  if product_descriptions = filters.delete('ProductDescription')
    params.merge!(Fog::AWS.indexed_param('ProductDescription', [*product_descriptions]))
  end

  params.merge!(Fog::AWS.indexed_filters(filters))

  request({
    'Action'    => 'DescribeSpotPriceHistory',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DescribeSpotPriceHistory.new
  }.merge!(params))
end

#describe_subnets(filters = {}) ⇒ Object

Describe all or specified subnets

Parameters

  • filters<~Hash> - List of filters to limit results with

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘subnetSet’<~Array>:

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

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

    • ‘vpcId’<~String> - The ID of the VPC the subnet is in

    • ‘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

    • ‘mapPublicIpOnLaunch’<~Boolean> - Indicates whether instances launched in this subnet receive a public IPv4 address.

    • ‘defaultForAz’<~Boolean> - Indicates whether this is the default subnet for the Availability Zone.

Amazon API Reference



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

def describe_subnets(filters = {})
  unless filters.is_a?(Hash)
    Fog::Logger.warning("describe_subnets with #{filters.class} param is deprecated, use describe_subnets('subnet-id' => []) instead [light_black](#{caller.first})[/]")
    filters = {'subnet-id' => [*filters]}
  end
  params = Fog::AWS.indexed_filters(filters)
  request({
    'Action'    => 'DescribeSubnets',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DescribeSubnets.new
  }.merge!(params))
end

#describe_tags(filters = {}) ⇒ Object

Describe all or specified tags

Parameters

  • filters<~Hash> - List of filters to limit results with

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘tagSet’<~Array>:

        • ‘resourceId’<~String> - id of resource tag belongs to

        • ‘resourceType’<~String> - type of resource tag belongs to

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

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

Amazon API Reference



23
24
25
26
27
28
29
30
# File 'lib/fog/aws/requests/compute/describe_tags.rb', line 23

def describe_tags(filters = {})
  params = Fog::AWS.indexed_filters(filters)
  request({
    'Action'    => 'DescribeTags',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DescribeTags.new
  }.merge!(params))
end

#describe_volume_status(filters = {}) ⇒ Object

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/aws/requests/compute/describe_volume_status.rb', line 8

def describe_volume_status(filters = {})
  raise ArgumentError.new("Filters must be a hash, but is a #{filters.class}.") unless filters.is_a?(Hash)
  next_token = filters.delete('nextToken') || filters.delete('NextToken')
  max_results = filters.delete('maxResults') || filters.delete('MaxResults')

  params = Fog::AWS.indexed_request_param('VolumeId', filters.delete('VolumeId'))

  params.merge!(Fog::AWS.indexed_filters(filters))

  params['NextToken'] = next_token if next_token
  params['MaxResults'] = max_results if max_results

  request({
    'Action'    => 'DescribeVolumeStatus',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DescribeVolumeStatus.new
  }.merge!(params))
end

#describe_volumes(filters = {}) ⇒ Object

Describe all or specified volumes.

Parameters

  • filters<~Hash> - List of filters to limit results with

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘volumeSet’<~Array>:

        • ‘availabilityZone’<~String> - Availability zone for volume

        • ‘createTime’<~Time> - Timestamp for creation

        • ‘encrypted’<~Boolean> - Indicates whether the volume will be encrypted

        • ‘iops’<~Integer> - Number of IOPS volume supports

        • ‘size’<~Integer> - Size in GiBs for volume

        • ‘snapshotId’<~String> - Snapshot volume was created from, if any

        • ‘status’<~String> - State of volume

        • ‘volumeId’<~String> - Reference to volume

        • ‘volumeType’<~String> - Type of volume

        • ‘attachmentSet’<~Array>:

          • ‘attachmentTime’<~Time> - Timestamp for attachment

          • ‘deleteOnTermination’<~Boolean> - Whether or not to delete volume on instance termination

          • ‘device’<~String> - How value is exposed to instance

          • ‘instanceId’<~String> - Reference to attached instance

          • ‘status’<~String> - Attachment state

          • ‘volumeId’<~String> - Reference to volume

Amazon API Reference



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/fog/aws/requests/compute/describe_volumes.rb', line 34

def describe_volumes(filters = {})
  unless filters.is_a?(Hash)
    Fog::Logger.deprecation("describe_volumes with #{filters.class} param is deprecated, use describe_volumes('volume-id' => []) instead [light_black](#{caller.first})[/]")
    filters = {'volume-id' => [*filters]}
  end
  params = Fog::AWS.indexed_filters(filters)
  request({
    'Action'    => 'DescribeVolumes',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DescribeVolumes.new
  }.merge!(params))
end

#describe_volumes_modifications(filters = {}) ⇒ Object

Reports the current modification status of EBS volumes.

Parameters

  • filters<~Hash> - List of filters to limit results with

Returns

  • response<~Excon::Response>:

    • body<~Hash>

      • ‘volumeModificationSet’<~Array>:

        • ‘targetIops’<~Integer> - Target IOPS rate of the volume being modified.

        • ‘originalIops’<~Integer> - Original IOPS rate of the volume being modified.

        • ‘modificationState’<~String> - Current state of modification. Modification state is null for unmodified volumes.

        • ‘targetSize’<~Integer> - Target size of the volume being modified.

        • ‘targetVolumeType’<~String> - Target EBS volume type of the volume being modified.

        • ‘volumeId’<~String> - ID of the volume being modified.

        • ‘progress’<~Integer> - Modification progress from 0 to 100%.

        • ‘startTime’<~Time> - Modification start time

        • ‘endTime’<~Time> - Modification end time

        • ‘originalSize’<~Integer> - Original size of the volume being modified.

        • ‘originalVolumeType’<~String> - Original EBS volume type of the volume being modified.



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fog/aws/requests/compute/describe_volumes_modifications.rb', line 28

def describe_volumes_modifications(filters = {})
  params = {}
  if volume_id = filters.delete('volume-id')
    params.merge!(Fog::AWS.indexed_param('VolumeId.%d', [*volume_id]))
  end
  params.merge!(Fog::AWS.indexed_filters(filters))
  request({
    'Action'    => 'DescribeVolumesModifications',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DescribeVolumesModifications.new
  }.merge(params))
end

#describe_vpc_attribute(vpc_id, attribute) ⇒ Object

Describes a vpc attribute value

Parameters

  • vpc_id<~String> - The ID of the VPC you want to describe an attribute of

  • attribute<~String> - The attribute to describe, must be one of ‘enableDnsSupport’ or ‘enableDnsHostnames’

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘vpcId’<~String> - The ID of the VPC

  • ‘enableDnsSupport’<~Boolean> - Flag indicating whether DNS resolution is enabled for the VPC (if requested)

  • ‘enableDnsHostnames’<~Boolean> - Flag indicating whether the instances launched in the VPC get DNS hostnames (if requested)

(Amazon API Reference)



21
22
23
24
25
26
27
28
# File 'lib/fog/aws/requests/compute/describe_vpc_attribute.rb', line 21

def describe_vpc_attribute(vpc_id, attribute)
  request(
    'Action'    => 'DescribeVpcAttribute',
    'VpcId'     => vpc_id,
    'Attribute' => attribute,
    :parser     => Fog::Parsers::AWS::Compute::DescribeVpcAttribute.new
  )
end

Describes the ClassicLink status of one or more VPCs.

Parameters

  • options<~Hash>

    • vpc_ids<~Array> - An array of vpc ids to restruct the results to

    • filters<~Hash> - Filters to restrict the results to. Recognises is-classic-link-enabled in addition

      to tag-key, tag-value and tag:key
      

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘vpcSet’<~Array> - array of VpcClassicLink

    • ‘vpcId’<~String>

    • ‘classicLinkEnabled’<~Boolean>

    • ‘tagSet’<~Hash>

(Amazon API Reference)[docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVpcClassicLink.html



23
24
25
26
27
28
29
30
31
# File 'lib/fog/aws/requests/compute/describe_vpc_classic_link.rb', line 23

def describe_vpc_classic_link(options={})
  params = {}
  params.merge!(Fog::AWS.indexed_param('VpcId', options[:vpc_ids])) if options[:vpc_ids]
  params.merge!(Fog::AWS.indexed_filters(options[:filters])) if options[:filters]
  request({
    'Action'    => 'DescribeVpcClassicLink',
    :parser     => Fog::Parsers::AWS::Compute::DescribeVpcClassicLink.new
  }.merge(params))
end

escribes the ClassicLink DNS support status of one or more VPCs

Parameters

  • options<~Hash>

    • vpc_ids<~Array> - An array of vpc ids to restrict results to

    • ‘MaxResults’ - Maximum number of items to return

    • ‘NextToken’ - The token for the next set of items to return

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘vpcs’<~Array> - Information about the ClassicLink DNS support status of the VPCs

        • ‘vpcId’<~String>

        • ‘classicLinkDnsSupported’<~Boolean>

docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVpcClassicLinkDnsSupport.html



25
26
27
28
29
30
31
32
33
34
# File 'lib/fog/aws/requests/compute/describe_vpc_classic_link_dns_support.rb', line 25

def describe_vpc_classic_link_dns_support(options={})
  params = {}
  params.merge!(Fog::AWS.indexed_param('VpcIds', options[:vpc_ids])) if options[:vpc_ids]
  request({
    'Action'     => 'DescribeVpcClassicLinkDnsSupport',
    'MaxResults' => options['MaxResults'],
    'NextToken'  => options['NextToken'],
    :parser      => Fog::Parsers::AWS::Compute::DescribeVpcClassicLinkDnsSupport.new
  }.merge(params))
end

#describe_vpcs(filters = {}) ⇒ Object

Describe all or specified vpcs

Parameters

  • filters<~Hash> - List of filters to limit results with

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘vpcSet’<~Array>:

  • ‘vpcId’<~String> - The VPC’s ID

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

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

  • ‘dhcpOptionsId’<~String> - The ID of the set of DHCP options.

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

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

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

  • ‘instanceTenancy’<~String> - The allowed tenancy of instances launched into the VPC.

Amazon API Reference



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/fog/aws/requests/compute/describe_vpcs.rb', line 27

def describe_vpcs(filters = {})
  unless filters.is_a?(Hash)
    Fog::Logger.warning("describe_vpcs with #{filters.class} param is deprecated, use describe_vpcs('vpc-id' => []) instead [light_black](#{caller.first})[/]")
    filters = {'vpc-id' => [*filters]}
  end
  params = Fog::AWS.indexed_filters(filters)
  request({
    'Action' => 'DescribeVpcs',
    :idempotent => true,
    :parser => Fog::Parsers::AWS::Compute::DescribeVpcs.new
  }.merge!(params))
end

Links an EC2-Classic instance to a ClassicLink-enabled VPC through one or more of the VPC’s security groups

Parameters

  • vpc_id<~String> - The ID of the vpc to which the instance is linkced.

  • instance_id<~String> - The ID of an EC2-Classic instance to unlink from the vpc.

  • security_group_ids<~String> - The ID of one or more of the VPC’s security groups. You cannot specify security groups from a different VPC.

  • dry_run<~Boolean> - defaults to false

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘return’<~Boolean> - Whether the request succeeded

(Amazon API Reference)



21
22
23
24
25
26
27
28
29
# File 'lib/fog/aws/requests/compute/detach_classic_link_vpc.rb', line 21

def detach_classic_link_vpc(instance_id, vpc_id, dry_run=false)
  request(
    'Action'    => 'DetachClassicLinkVpc',
    'VpcId'     => vpc_id,
    'InstanceId'=> instance_id,
    'DryRun'    => dry_run,
    :parser     => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#detach_internet_gateway(internet_gateway_id, vpc_id) ⇒ Object

Detaches an Internet gateway to a VPC, enabling connectivity between the Internet and the VPC

Parameters

  • internet_gateway_id<~String> - The ID of the Internet gateway to detach

  • vpc_id<~String> - The ID of the VPC

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - Returns true if the request succeeds.

Amazon API Reference



19
20
21
22
23
24
25
26
27
# File 'lib/fog/aws/requests/compute/detach_internet_gateway.rb', line 19

def detach_internet_gateway(internet_gateway_id, vpc_id)
  request(
    'Action'               => 'DetachInternetGateway',
    'InternetGatewayId'    => internet_gateway_id,
    'VpcId'                => vpc_id,
    :idempotent   => true,
    :parser       => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#detach_network_interface(attachment_id, force = false) ⇒ Object

Detaches a network interface.

Parameters

  • attachment_id<~String> - ID of the attachment to detach

  • force<~Boolean> - Set to true to force a detachment

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘return’<~Boolean> - Returns true if the request succeeds.

Amazon API Reference



19
20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/compute/detach_network_interface.rb', line 19

def detach_network_interface(attachment_id, force = false)
  request(
    'Action'       => 'DetachNetworkInterface',
    'AttachmentId' => attachment_id,
    'Force'        => force,
    :parser        => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#detach_volume(volume_id, options = {}) ⇒ Object

Detach an Amazon EBS volume from a running instance

Parameters

  • volume_id<~String> - Id of amazon EBS volume to associate with instance

  • options<~Hash>:

    • ‘Device’<~String> - Specifies how the device is exposed to the instance (e.g. “/dev/sdh”)

    • ‘Force’<~Boolean> - If true forces detach, can cause data loss/corruption

    • ‘InstanceId’<~String> - Id of instance to associate volume with

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘attachTime’<~Time> - Time of attachment was initiated at

      • ‘device’<~String> - Device as it is exposed to the instance

      • ‘instanceId’<~String> - Id of instance for volume

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

      • ‘status’<~String> - Status of volume

      • ‘volumeId’<~String> - Reference to volume

Amazon API Reference



27
28
29
30
31
32
33
34
# File 'lib/fog/aws/requests/compute/detach_volume.rb', line 27

def detach_volume(volume_id, options = {})
  request({
    'Action'    => 'DetachVolume',
    'VolumeId'  => volume_id,
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::DetachVolume.new
  }.merge!(options))
end

disavbles classic link for a vpc

Parameters

  • vpc_id<~String> - The ID of the VPC you want to describe an attribute of

  • dry_run<~Boolean> - defaults to false

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘return’<~Boolean> - Whether the request succeeded

(Amazon API Reference)



19
20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/compute/disable_vpc_classic_link.rb', line 19

def disable_vpc_classic_link(vpc_id, dry_run=false)
  request(
    'Action'    => 'DisableVpcClassicLink',
    'VpcId'     => vpc_id,
    'DryRun'    => dry_run,
    :parser     => Fog::Parsers::AWS::Compute::Basic.new
  )
end

Disables DNS hostname resolution for ClassicLink

Parameters

  • vpc_id<~String> - The ID of the ClassicLink-enabled VPC.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - Whether the request succeeded

docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DisableVpcClassicLinkDnsSupport.html



20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/compute/disable_vpc_classic_link_dns_support.rb', line 20

def disable_vpc_classic_link_dns_support(vpc_id)
  request(
    'Action' => 'DisableVpcClassicLinkDnsSupport',
    'VpcId'  => vpc_id,
    :parser  => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#disassociate_address(public_ip = nil, association_id = nil) ⇒ Object

Disassociate an elastic IP address from its instance (if any)

Parameters

  • public_ip<~String> - Public ip to assign to instance

  • association_id<~String> - Id associating eip to an network interface

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - success?

Amazon API Reference



20
21
22
23
24
25
26
27
28
# File 'lib/fog/aws/requests/compute/disassociate_address.rb', line 20

def disassociate_address(public_ip=nil, association_id=nil)
  request(
    'Action'        => 'DisassociateAddress',
    'PublicIp'      => public_ip,
    'AssociationId' => association_id,
    :idempotent     => true,
    :parser         => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#disassociate_route_table(association_id) ⇒ Object

Disassociates a subnet from a route table.

Parameters

  • AssociationId<~String> - The association ID representing the current association between the route table and subnet.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘requestId’<~String> - The ID of the request.

      • ‘return’<~Boolean> - Returns true if the request succeeds. Otherwise, returns an error.

Amazon API Reference



19
20
21
22
23
24
25
# File 'lib/fog/aws/requests/compute/disassociate_route_table.rb', line 19

def disassociate_route_table(association_id)
  request(
    'Action'        => 'DisassociateRouteTable',
    'AssociationId' => association_id,
    :parser         => Fog::Parsers::AWS::Compute::Basic.new
  )
end

enables classic link for a vpc

Parameters

  • vpc_id<~String> - The ID of the VPC you want to describe an attribute of

  • dry_run<~Boolean> - defaults to false

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘return’<~Boolean> - Whether the request succeeded

(Amazon API Reference)



19
20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/compute/enable_vpc_classic_link.rb', line 19

def enable_vpc_classic_link(vpc_id, dry_run=false)
  request(
    'Action'    => 'EnableVpcClassicLink',
    'VpcId'     => vpc_id,
    'DryRun'    => dry_run,
    :parser     => Fog::Parsers::AWS::Compute::Basic.new
  )
end

Enables a VPC to support DNS hostname resolution for ClassicLink

Parameters

  • vpc_id<~String> - The ID of the ClassicLink-enabled VPC.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - Whether the request succeeded

docs.aws.amazon.com/AWSEC2/latest/APIReference/API_EnableVpcClassicLinkDnsSupport.html



20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/compute/enable_vpc_classic_link_dns_support.rb', line 20

def enable_vpc_classic_link_dns_support(vpc_id)
  request(
    'Action' => 'EnableVpcClassicLinkDnsSupport',
    'VpcId'  => vpc_id,
    :parser  => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#get_console_output(instance_id) ⇒ Object

Retrieve console output for specified instance

Parameters

  • instance_id<~String> - Id of instance to get console output from

Returns

# * response<~Excon::Response>:

* body<~Hash>:
  * 'instanceId'<~String> - Id of instance
  * 'output'<~String> - Console output
  * 'requestId'<~String> - Id of request
  * 'timestamp'<~Time> - Timestamp of last update to output

Amazon API Reference



21
22
23
24
25
26
27
28
# File 'lib/fog/aws/requests/compute/get_console_output.rb', line 21

def get_console_output(instance_id)
  request(
    'Action'      => 'GetConsoleOutput',
    'InstanceId'  => instance_id,
    :idempotent   => true,
    :parser       => Fog::Parsers::AWS::Compute::GetConsoleOutput.new
  )
end

#get_password_data(instance_id) ⇒ Object

Retrieves the encrypted administrator password for an instance running Windows.

Parameters

  • instance_id<~String> - A Windows instance ID

Returns

# * response<~Excon::Response>:

* body<~Hash>:
  * 'instanceId'<~String> - Id of instance
  * 'passwordData'<~String> - The encrypted, base64-encoded password of the instance.
  * 'requestId'<~String> - Id of request
  * 'timestamp'<~Time> - Timestamp of last update to output

See docs.amazonwebservices.com/AWSEC2/2010-08-31/APIReference/index.html?ApiReference-query-GetPasswordData.html

Amazon API Reference



23
24
25
26
27
28
29
30
# File 'lib/fog/aws/requests/compute/get_password_data.rb', line 23

def get_password_data(instance_id)
  request(
    'Action'      => 'GetPasswordData',
    'InstanceId'  => instance_id,
    :idempotent   => true,
    :parser       => Fog::Parsers::AWS::Compute::GetPasswordData.new
  )
end

#import_key_pair(key_name, public_key_material) ⇒ Object

Import an existing public key to create a new key pair

Parameters

  • key_name<~String> - Unique name for key pair.

  • public_key_material<~String> - RSA public key

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘keyFingerprint’<~String> - SHA-1 digest of DER encoded private key

      • ‘keyName’<~String> - Name of key

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

Amazon API Reference



21
22
23
24
25
26
27
28
# File 'lib/fog/aws/requests/compute/import_key_pair.rb', line 21

def import_key_pair(key_name, public_key_material)
  request(
    'Action'  => 'ImportKeyPair',
    'KeyName' => key_name,
    'PublicKeyMaterial' => Base64::encode64(public_key_material),
    :parser   => Fog::Parsers::AWS::Compute::ImportKeyPair.new
  )
end

#modify_image_attribute(image_id, attributes) ⇒ Object

Modify image attributes

Parameters

  • image_id<~String> - Id of machine image to modify

  • attributes<~Hash>:

    • ‘Add.Group’<~Array> - One or more groups to grant launch permission to

    • ‘Add.UserId’<~Array> - One or more account ids to grant launch permission to

    • ‘Description.Value’<String> - New description for image

    • ‘ProductCode’<~Array> - One or more product codes to add to image (these can not be removed)

    • ‘Remove.Group’<~Array> - One or more groups to revoke launch permission from

    • ‘Remove.UserId’<~Array> - One or more account ids to revoke launch permission from

Amazon API Reference

Raises:

  • (ArgumentError)


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/fog/aws/requests/compute/modify_image_attribute.rb', line 21

def modify_image_attribute(image_id, attributes)
  raise ArgumentError.new("image_id is required") unless image_id

  params = {}
  params.merge!(Fog::AWS.indexed_param('LaunchPermission.Add.%d.Group', attributes['Add.Group'] || []))
  params.merge!(Fog::AWS.indexed_param('LaunchPermission.Add.%d.UserId', attributes['Add.UserId'] || []))
  params.merge!(Fog::AWS.indexed_param('LaunchPermission.Remove.%d.Group', attributes['Remove.Group'] || []))
  params.merge!(Fog::AWS.indexed_param('LaunchPermission.Remove.%d.UserId', attributes['Remove.UserId'] || []))
  params.merge!(Fog::AWS.indexed_param('ProductCode', attributes['ProductCode'] || []))
  request({
    'Action'        => 'ModifyImageAttribute',
    'ImageId'       => image_id,
    :idempotent     => true,
    :parser         => Fog::Parsers::AWS::Compute::Basic.new
  }.merge!(params))
end

#modify_image_attributes(*params) ⇒ Object



178
179
180
181
# File 'lib/fog/aws/compute.rb', line 178

def modify_image_attributes(*params)
  Fog::Logger.deprecation("modify_image_attributes is deprecated, use modify_image_attribute instead [light_black](#{caller.first})[/]")
  modify_image_attribute(*params)
end

#modify_instance_attribute(instance_id, attributes) ⇒ Object

Modify instance attributes

Parameters

  • instance_id<~String> - Id of instance to modify

  • attributes<~Hash>: ‘InstanceType.Value’<~String> - New instance type ‘Kernel.Value’<~String> - New kernel value ‘Ramdisk.Value’<~String> - New ramdisk value ‘UserData.Value’<~String> - New userdata value ‘DisableApiTermination.Value’<~Boolean> - Change api termination value ‘InstanceInitiatedShutdownBehavior.Value’<~String> - New instance initiated shutdown behaviour, in [‘stop’, ‘terminate’] ‘SourceDestCheck.Value’<~Boolean> - New sourcedestcheck value ‘GroupId’<~Array> - One or more groups to add instance to (VPC only)

Amazon API Reference



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fog/aws/requests/compute/modify_instance_attribute.rb', line 23

def modify_instance_attribute(instance_id, attributes)
  params = {}
  params.merge!(Fog::AWS.indexed_param('GroupId', attributes.delete('GroupId') || []))
  params.merge!(attributes)
  request({
    'Action'        => 'ModifyInstanceAttribute',
    'InstanceId'    => instance_id,
    :idempotent     => true,
    :parser         => Fog::Parsers::AWS::Compute::Basic.new
  }.merge!(params))
end

#modify_instance_attributes(instance_id, attributes) ⇒ Object



35
36
37
38
# File 'lib/fog/aws/requests/compute/modify_instance_attribute.rb', line 35

def modify_instance_attributes(instance_id, attributes)
  Fog::Logger.deprecation("modify_instance_attributes method is deprecated, use 'modify_instance_attribute' instead")
  modify_instance_attribute(instance_id, attributes)
end

#modify_instance_placement(instance_id, attributes) ⇒ Object

Modify instance placement

Parameters

  • instance_id<~String> - Id of instance to modify

  • attributes<~Hash>: ‘Affinity.Value’<~String> - The affinity setting for the instance, in [‘default’, ‘host’] ‘GroupName.Value’<~String> - The name of the placement group in which to place the instance ‘HostId.Value’<~String> - The ID of the Dedicated Host with which to associate the instance ‘Tenancy.Value’<~String> - The tenancy for the instance, in [‘dedicated’, ‘host’]

Amazon API Reference



19
20
21
22
23
24
25
26
27
28
# File 'lib/fog/aws/requests/compute/modify_instance_placement.rb', line 19

def modify_instance_placement(instance_id, attributes)
  params = {}
  params.merge!(attributes)
  request({
    'Action'        => 'ModifyInstancePlacement',
    'InstanceId'    => instance_id,
    :idempotent     => true,
    :parser         => Fog::Parsers::AWS::Compute::Basic.new
  }.merge!(params))
end

#modify_network_interface_attribute(network_interface_id, attribute, value) ⇒ Object

Modifies a network interface attribute value

Parameters

  • network_interface_id<~String> - The ID of the network interface you want to describe an attribute of

  • attribute<~String> - The attribute to modify, must be one of ‘description’, ‘groupSet’, ‘sourceDestCheck’ or ‘attachment’

  • value<~Object> - New value of attribute, the actual type depends on the attribute:

    description     - a string
    groupSet        - a list of group id's
    sourceDestCheck - a boolean value
    attachment      - a hash with:
                        attachmentid - the attachment to change
                        deleteOnTermination - a boolean
    

Amazon API Reference



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/fog/aws/requests/compute/modify_network_interface_attribute.rb', line 21

def modify_network_interface_attribute(network_interface_id, attribute, value)
  params = {}
  case attribute
  when 'description'
    params['Description.Value'] = value
  when 'groupSet'
    params.merge!(Fog::AWS.indexed_param('SecurityGroupId.%d', value))
  when 'sourceDestCheck'
    params['SourceDestCheck.Value'] = value
  when 'attachment'
    params['Attachment.AttachmentId']        = value['attachmentId']
    params['Attachment.DeleteOnTermination'] = value['deleteOnTermination']
  else
    raise Fog::AWS::Compute::Error.new("Illegal attribute '#{attribute}' specified")
  end

  request({
    'Action'             => 'ModifyNetworkInterfaceAttribute',
    'NetworkInterfaceId' => network_interface_id,
    :parser              => Fog::Parsers::AWS::Compute::Basic.new
  }.merge!(params))
end

#modify_snapshot_attribute(snapshot_id, attributes) ⇒ Object

Modify snapshot attributes

Parameters

  • snapshot_id<~String> - Id of snapshot to modify

  • attributes<~Hash>:

    • ‘Add.Group’<~Array> - One or more groups to grant volume create permission to

    • ‘Add.UserId’<~Array> - One or more account ids to grant volume create permission to

    • ‘Remove.Group’<~Array> - One or more groups to revoke volume create permission from

    • ‘Remove.UserId’<~Array> - One or more account ids to revoke volume create permission from

Amazon API Reference



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fog/aws/requests/compute/modify_snapshot_attribute.rb', line 19

def modify_snapshot_attribute(snapshot_id, attributes)
  params = {}
  params.merge!(Fog::AWS.indexed_param('CreateVolumePermission.Add.%d.Group', attributes['Add.Group'] || []))
  params.merge!(Fog::AWS.indexed_param('CreateVolumePermission.Add.%d.UserId', attributes['Add.UserId'] || []))
  params.merge!(Fog::AWS.indexed_param('CreateVolumePermission.Remove.%d.Group', attributes['Remove.Group'] || []))
  params.merge!(Fog::AWS.indexed_param('CreateVolumePermission.Remove.%d.UserId', attributes['Remove.UserId'] || []))
  request({
    'Action'        => 'ModifySnapshotAttribute',
    'SnapshotId'    => snapshot_id,
    :idempotent     => true,
    :parser         => Fog::Parsers::AWS::Compute::Basic.new
  }.merge!(params))
end

#modify_subnet_attribute(subnet_id, options = {}) ⇒ Object

Modifies a subnet attribute.

Parameters

  • SubnetId<~String> - The id of the subnet to modify

  • options<~Hash>:

    • MapPublicIpOnLaunch<~Boolean> - Modifies the public IP addressing behavior for the subnet. Specify true to indicate that instances launched into the specified subnet should be assigned a public IP address. If set to true, the instance receives a public IP address only if the instance is launched with a single, new network interface with the device index of 0.

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘return’<~Boolean> - Returns true if the request succeeds. Otherwise, returns an error.

docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-ModifySubnetAttribute.html



23
24
25
26
27
28
29
30
31
# File 'lib/fog/aws/requests/compute/modify_subnet_attribute.rb', line 23

def modify_subnet_attribute(subnet_id, options = {})
  params = {}
  params['MapPublicIpOnLaunch.Value'] = options.delete 'MapPublicIpOnLaunch' if options['MapPublicIpOnLaunch']
  request({
    'Action' => 'ModifySubnetAttribute',
    'SubnetId' => subnet_id,
    :parser => Fog::Parsers::AWS::Compute::ModifySubnetAttribute.new
  }.merge(params))
end

#modify_volume(volume_id, options = {}) ⇒ Object

Modifies a volume

Parameters

  • volume_id<~String> - The ID of the volume

  • options<~Hash>:

    • ‘VolumeType’<~String> - Type of volume

    • ‘Size’<~Integer> - Size in GiBs of the volume

    • ‘Iops’<~Integer> - Number of IOPS the volume supports

Response

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘targetIops’<~Integer> - Target IOPS rate of the volume being modified.

      • ‘originalIops’<~Integer> - Original IOPS rate of the volume being modified.

      • ‘modificationState’<~String> - Current state of modification. Modification state is null for unmodified volumes.

      • ‘targetSize’<~Integer> - Target size of the volume being modified.

      • ‘targetVolumeType’<~String> - Target EBS volume type of the volume being modified.

      • ‘volumeId’<~String> - ID of the volume being modified.

      • ‘progress’<~Integer> - Modification progress from 0 to 100%.

      • ‘startTime’<~Time> - Modification start time

      • ‘endTime’<~Time> - Modification end time

      • ‘originalSize’<~Integer> - Original size of the volume being modified.

      • ‘originalVolumeType’<~String> - Original EBS volume type of the volume being modified.



31
32
33
34
35
36
37
# File 'lib/fog/aws/requests/compute/modify_volume.rb', line 31

def modify_volume(volume_id, options={})
  request({
    'Action'   => "ModifyVolume",
    'VolumeId' => volume_id,
    :parser    => Fog::Parsers::AWS::Compute::ModifyVolume.new
  }.merge(options))
end

#modify_volume_attribute(volume_id = nil, auto_enable_io_value = false) ⇒ Object

Modifies a volume attribute.

Parameters

  • volume_id<~String> - The ID of the volume.

  • auto_enable_io_value<~Boolean> - This attribute exists to auto-enable the I/O operations to the volume.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - success?

Amazon API Reference



20
21
22
23
24
25
26
27
28
# File 'lib/fog/aws/requests/compute/modify_volume_attribute.rb', line 20

def modify_volume_attribute(volume_id=nil, auto_enable_io_value=false)
  request(
    'Action'             => 'ModifyVolumeAttribute',
    'VolumeId'           => volume_id,
    'AutoEnableIO.Value' => auto_enable_io_value,
    :idempotent          => true,
    :parser              => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#modify_vpc_attribute(vpc_id, options = {}) ⇒ Object

Modifies the specified attribute of the specified VPC.

Parameters

  • vpc_id<~String> - The ID of the VPC.

  • options<~Hash>:

    • enableDnsSupport<~Boolean> - Indicates whether DNS resolution is supported for the VPC. If this attribute is true, the Amazon DNS server resolves DNS hostnames for your instances to their corresponding IP addresses; otherwise, it does not.

    • enableDnsHostnames<~Boolean> - Indicates whether the instances launched in the VPC get DNS hostnames. If this attribute is true, instances in the VPC get DNS hostnames; otherwise, they do not. You can only set enableDnsHostnames to true if you also set the EnableDnsSupport attribute to true.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - success?

Amazon API Reference



25
26
27
28
29
30
31
32
# File 'lib/fog/aws/requests/compute/modify_vpc_attribute.rb', line 25

def modify_vpc_attribute(vpc_id, options = {})
  request({
    'Action'             => 'ModifyVpcAttribute',
    'VpcId'              => vpc_id,
    :idempotent          => true,
    :parser              => Fog::Parsers::AWS::Compute::Basic.new
  }.merge!(options))
end

#monitor_instances(instance_ids) ⇒ Object

Monitor specified instance docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-MonitorInstances.html

Parameters

  • instance_ids<~Array> - Arrays of instances Ids to monitor

Returns

Amazon API Reference



20
21
22
23
24
25
26
27
# File 'lib/fog/aws/requests/compute/monitor_instances.rb', line 20

def monitor_instances(instance_ids)
  params = Fog::AWS.indexed_param('InstanceId', instance_ids)
  request({
                  'Action' => 'MonitorInstances',
                  :idempotent => true,
                  :parser => Fog::Parsers::AWS::Compute::MonitorUnmonitorInstances.new
          }.merge!(params))
end

#move_address_to_vpc(public_ip) ⇒ Object

Move address to VPC scope

Returns

  • response<~Excon::Response>:

    • body<~<Hash>:

      • ‘allocationId’<~String> - The allocation ID for the Elastic IP address

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

      • ‘status’<~String> - The status of the move of the IP address (MoveInProgress | InVpc | InClassic)



16
17
18
19
20
21
22
23
# File 'lib/fog/aws/requests/compute/move_address_to_vpc.rb', line 16

def move_address_to_vpc(public_ip)
  request(
    'Action' => 'MoveAddressToVpc',
    'PublicIp' => public_ip,
    :idempotent => true,
    :parser => Fog::Parsers::AWS::Compute::MoveAddressToVpc.new
  )
end

#purchase_reserved_instances_offering(reserved_instances_offering_id, instance_count = 1) ⇒ Object

Purchases a Reserved Instance for use with your account.

Parameters

  • reserved_instances_offering_id<~String> - ID of the Reserved Instance offering you want to purchase.

  • instance_count<~Integer> - The number of Reserved Instances to purchase.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘reservedInstancesId’<~String> - Id of the purchased reserved instances.

Amazon API Reference



20
21
22
23
24
25
26
27
28
# File 'lib/fog/aws/requests/compute/purchase_reserved_instances_offering.rb', line 20

def purchase_reserved_instances_offering(reserved_instances_offering_id, instance_count = 1)
  request({
    'Action'                      => 'PurchaseReservedInstancesOffering',
    'ReservedInstancesOfferingId' => reserved_instances_offering_id,
    'InstanceCount'               => instance_count,
    :idempotent                   => true,
    :parser                       => Fog::Parsers::AWS::Compute::PurchaseReservedInstancesOffering.new
  })
end

#reboot_instances(instance_id = []) ⇒ Object

Reboot specified instances

Parameters

  • instance_id<~Array> - Ids of instances to reboot

Returns

# * response<~Excon::Response>:

* body<~Hash>:
  * 'requestId'<~String> - Id of request
  * 'return'<~Boolean> - success?

Amazon API Reference



19
20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/compute/reboot_instances.rb', line 19

def reboot_instances(instance_id = [])
  params = Fog::AWS.indexed_param('InstanceId', instance_id)
  request({
    'Action'    => 'RebootInstances',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::Basic.new
  }.merge!(params))
end

#register_image(name, description, location, block_devices = [], options = {}) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/fog/aws/requests/compute/register_image.rb', line 37

def register_image(name, description, location, block_devices=[], options={})
  common_options = {
    'Action'      => 'RegisterImage',
    'Name'        => name,
    'Description' => description,
    :parser       => Fog::Parsers::AWS::Compute::RegisterImage.new
  }

  # This determines if we are doing a snapshot or a S3 backed AMI.
  if(location =~ /^\/dev\/(xvd|sd)[a-p]\d{0,2}$/)
    common_options['RootDeviceName'] = location
  else
    common_options['ImageLocation'] = location
  end

  block_devices.each_with_index do |bd, index|
    index += 1
    ["DeviceName","VirtualName"].each do |n|
      common_options["BlockDeviceMapping.#{index}.#{n}"] = bd[n] if bd[n]
    end
    ["SnapshotId","VolumeSize","NoDevice","DeleteOnTermination"].each do |n|
      common_options["BlockDeviceMapping.#{index}.Ebs.#{n}"] = bd[n] if bd[n]
    end
  end

  request(common_options.merge!(options))
end

#release_address(ip_or_allocation) ⇒ Object

Release an elastic IP address.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - success?

Amazon API Reference

non-VPC: requires public_ip only

VPC: requires allocation_id only


19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fog/aws/requests/compute/release_address.rb', line 19

def release_address(ip_or_allocation)
  field = if ip_or_allocation.to_s =~ /^(\d|\.)+$/
            "PublicIp"
          else
            "AllocationId"
          end
  request(
    'Action'    => 'ReleaseAddress',
    field       => ip_or_allocation,
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#reloadObject



583
584
585
# File 'lib/fog/aws/compute.rb', line 583

def reload
  @connection.reset
end

#replace_network_acl_association(association_id, network_acl_id) ⇒ Object

Replace the network ACL for a subnet with a

Parameters

  • association_id<~String> - The ID of the current association between the original network ACL and the subnet

  • network_acl_id<~String> - The ID of the network ACL

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘return’<~Boolean> - Returns true if the request succeeds.

Amazon API Reference



20
21
22
23
24
25
26
27
# File 'lib/fog/aws/requests/compute/replace_network_acl_association.rb', line 20

def replace_network_acl_association(association_id, network_acl_id)
  request({
    'Action'        => 'ReplaceNetworkAclAssociation',
    'AssociationId' => association_id,
    'NetworkAclId'  => network_acl_id,
    :parser         => Fog::Parsers::AWS::Compute::ReplaceNetworkAclAssociation.new
  })
end

#replace_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options = {}) ⇒ Object

Replaces a Network ACL entry with the same rule number

Parameters

  • network_acl_id<~String> - The ID of the ACL to add this entry to

  • rule_number<~Integer> - The rule number for the entry, between 100 and 32766

  • protocol<~Integer> - The IP protocol to which the rule applies. You can use -1 to mean all protocols.

  • rule_action<~String> - Allows or denies traffic that matches the rule. (either allow or deny)

  • cidr_block<~String> - The CIDR range to allow or deny

  • egress<~Boolean> - Indicates whether this rule applies to egress traffic from the subnet (true) or ingress traffic to the subnet (false).

  • options<~Hash>:

  • ‘Icmp.Code’ - ICMP code, required if protocol is 1

  • ‘Icmp.Type’ - ICMP type, required if protocol is 1

  • ‘PortRange.From’ - The first port in the range, required if protocol is 6 (TCP) or 17 (UDP)

  • ‘PortRange.To’ - The last port in the range, required if protocol is 6 (TCP) or 17 (UDP)

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘return’<~Boolean> - Returns true if the request succeeds.

Amazon API Reference



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

def replace_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options = {})
  request({
    'Action'       => 'ReplaceNetworkAclEntry',
    'NetworkAclId' => network_acl_id,
    'RuleNumber'   => rule_number,
    'Protocol'     => protocol,
    'RuleAction'   => rule_action,
    'Egress'       => egress,
    'CidrBlock'    => cidr_block,
    :parser        => Fog::Parsers::AWS::Compute::Basic.new
  }.merge!(options))
end

#replace_route(route_table_id, destination_cidr_block, options = {}) ⇒ Object

Replaces a route in a route table within a VPC.

Parameters

  • RouteTableId<~String> - The ID of the route table for the route.

  • options<~Hash>:

    • DestinationCidrBlock<~String> - The CIDR address block used for the destination match. Routing decisions are based on the most specific match.

    • GatewayId<~String> - The ID of an Internet gateway attached to your VPC.

    • InstanceId<~String> - The ID of a NAT instance in your VPC. The operation fails if you specify an instance ID unless exactly one network interface is attached.

    • NetworkInterfaceId<~String> - The ID of a network interface.

Returns

  • response<~Excon::Response>:

  • body<~Hash>:

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

  • ‘return’<~Boolean> - Returns true if the request succeeds. Otherwise, returns an error.

Amazon API Reference



24
25
26
27
28
29
30
31
32
33
# File 'lib/fog/aws/requests/compute/replace_route.rb', line 24

def replace_route(route_table_id, destination_cidr_block, options = {})
  options['DestinationCidrBlock'] ||= destination_cidr_block

  request({
    'Action' => 'ReplaceRoute',
    'RouteTableId' => route_table_id,
    :idempotent => true,
    :parser => Fog::Parsers::AWS::Compute::Basic.new
  }.merge!(options))
end

#request_spot_instances(image_id, instance_type, spot_price, options = {}) ⇒ Object

Launch specified instances

Parameters

  • ‘image_id’<~String> - Id of machine image to load on instances

  • ‘instance_type’<~String> - Type of instance

  • ‘spot_price’<~Float> - maximum hourly price for instances launched

  • options<~Hash>:

    • ‘AvailabilityZoneGroup’<~String> - specify whether or not to launch all instances in the same availability group

    • ‘InstanceCount’<~Integer> - maximum number of instances to launch

    • ‘LaunchGroup’<~String> - whether or not to launch/shutdown instances as a group

    • ‘LaunchSpecification.BlockDeviceMapping’<~Array>: array of hashes

      • ‘DeviceName’<~String> - where the volume will be exposed to instance

      • ‘VirtualName’<~String> - volume virtual device name

      • ‘Ebs.SnapshotId’<~String> - id of snapshot to boot volume from

      • ‘Ebs.NoDevice’<~String> - specifies that no device should be mapped

      • ‘Ebs.VolumeSize’<~String> - size of volume in GiBs required unless snapshot is specified

      • ‘Ebs.DeleteOnTermination’<~String> - specifies whether or not to delete the volume on instance termination

    • ‘LaunchSpecification.KeyName’<~String> - Name of a keypair to add to booting instances

    • ‘LaunchSpecification.Monitoring.Enabled’<~Boolean> - Enables monitoring, defaults to disabled

    • ‘LaunchSpecification.SubnetId’<~String> - VPC subnet ID in which to launch the instance

    • ‘LaunchSpecification.Placement.AvailabilityZone’<~String> - Placement constraint for instances

    • ‘LaunchSpecification.SecurityGroup’<~Array> or <~String> - Name of security group(s) for instances, not supported in VPC

    • ‘LaunchSpecification.SecurityGroupId’<~Array> or <~String> - Id of security group(s) for instances, use this or LaunchSpecification.SecurityGroup

    • ‘LaunchSpecification.UserData’<~String> - Additional data to provide to booting instances

    • ‘LaunchSpecification.EbsOptimized’<~Boolean> - Whether the instance is optimized for EBS I/O

    • ‘Type’<~String> - spot instance request type in [‘one-time’, ‘persistent’]

    • ‘ValidFrom’<~Time> - start date for request

    • ‘ValidUntil’<~Time> - end date for request

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘spotInstanceRequestSet’<~Array>:

        • ‘createTime’<~Time> - time of instance request creation

        • ‘instanceId’<~String> - instance id if one has been launched to fulfill request

        • ‘launchedAvailabilityZone’<~String> - availability zone of instance if one has been launched to fulfill request

        • ‘launchSpecification’<~Hash>:

          • ‘blockDeviceMapping’<~Hash> - list of block device mappings for instance

          • ‘groupSet’<~String> - security group(s) for instance

          • ‘keyName’<~String> - keypair name for instance

          • ‘imageId’<~String> - AMI for instance

          • ‘instanceType’<~String> - type for instance

          • ‘monitoring’<~Boolean> - monitoring status for instance

          • ‘subnetId’<~String> - VPC subnet ID for instance

        • ‘productDescription’<~String> - general description of AMI

        • ‘spotInstanceRequestId’<~String> - id of spot instance request

        • ‘spotPrice’<~Float> - maximum price for instances to be launched

        • ‘state’<~String> - spot instance request state

        • ‘type’<~String> - spot instance request type

Amazon API Reference



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/fog/aws/requests/compute/request_spot_instances.rb', line 59

def request_spot_instances(image_id, instance_type, spot_price, options = {})
  if block_device_mapping = options.delete('LaunchSpecification.BlockDeviceMapping')
    block_device_mapping.each_with_index do |mapping, index|
      for key, value in mapping
        options.merge!({ format("LaunchSpecification.BlockDeviceMapping.%d.#{key}", index) => value })
      end
    end
  end
  if security_groups = options.delete('LaunchSpecification.SecurityGroup')
    options.merge!(Fog::AWS.indexed_param('LaunchSpecification.SecurityGroup', [*security_groups]))
  end
  if security_group_ids = options.delete('LaunchSpecification.SecurityGroupId')
    options.merge!(Fog::AWS.indexed_param('LaunchSpecification.SecurityGroupId', [*security_group_ids]))
  end
  if options['LaunchSpecification.UserData']
    options['LaunchSpecification.UserData'] = Base64.encode64(options['LaunchSpecification.UserData']).chomp!
  end

  if options['ValidFrom'] && options['ValidFrom'].is_a?(Time)
    options['ValidFrom'] =  options['ValidFrom'].iso8601
  end

  if options['ValidUntil'] && options['ValidUntil'].is_a?(Time)
    options['ValidUntil'] =  options['ValidUntil'].iso8601
  end

  request({
    'Action'                            => 'RequestSpotInstances',
    'LaunchSpecification.ImageId'       => image_id,
    'LaunchSpecification.InstanceType'  => instance_type,
    'SpotPrice'                         => spot_price,
    :parser                             => Fog::Parsers::AWS::Compute::SpotInstanceRequests.new
  }.merge!(options))
end

#reset_network_interface_attribute(network_interface_id, attribute) ⇒ Object

Resets a network interface attribute value

Parameters

  • network_interface_id<~String> - The ID of the network interface you want to describe an attribute of

  • attribute<~String> - The attribute to reset, only ‘sourceDestCheck’ is supported.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - success?

Amazon API Reference



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fog/aws/requests/compute/reset_network_interface_attribute.rb', line 20

def reset_network_interface_attribute(network_interface_id, attribute)
  if attribute != 'sourceDestCheck'
    raise Fog::AWS::Compute::Error.new("Illegal attribute '#{attribute}' specified")
  end
  request(
    'Action'             => 'ResetNetworkInterfaceAttribute',
    'NetworkInterfaceId' => network_interface_id,
    'Attribute'          => attribute,
    :parser              => Fog::Parsers::AWS::Compute::Basic.new
  )
end

#restore_address_to_classic(public_ip) ⇒ Object

Move address from VPC to Classic

Returns

  • response<~Excon::Response>:

    • body<~<Hash>:

      • ‘publicIp’<~String> - IP address

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

      • ‘status’<~String> - The status of the move of the IP address (MoveInProgress | InVpc | InClassic)



16
17
18
19
20
21
22
23
# File 'lib/fog/aws/requests/compute/restore_address_to_classic.rb', line 16

def restore_address_to_classic(public_ip)
  request(
    'Action' => 'RestoreAddressToClassic',
    'PublicIp' => public_ip,
    :idempotent => true,
    :parser => Fog::Parsers::AWS::Compute::RestoreAddressToClassic.new
  )
end

#revoke_security_group_egress(group_name, options = {}) ⇒ Object

Remove permissions from a security group

Parameters

  • group_name<~String> - Name of group, optional (can also be specified as GroupName in options)

  • options<~Hash>:

    • ‘GroupName’<~String> - Name of security group to modify

    • ‘GroupId’<~String> - Id of security group to modify

    • ‘SourceSecurityGroupName’<~String> - Name of security group to authorize

    • ‘SourceSecurityGroupOwnerId’<~String> - Name of owner to authorize

    or

    • ‘CidrIp’<~String> - CIDR range

    • ‘FromPort’<~Integer> - Start of port range (or -1 for ICMP wildcard)

    • ‘IpProtocol’<~String> - Ip protocol, must be in [‘tcp’, ‘udp’, ‘icmp’]

    • ‘ToPort’<~Integer> - End of port range (or -1 for ICMP wildcard)

    or

    • ‘IpPermissions’<~Array>:

      • permission<~Hash>:

        • ‘FromPort’<~Integer> - Start of port range (or -1 for ICMP wildcard)

        • ‘Groups’<~Array>:

          • group<~Hash>:

            • ‘GroupName’<~String> - Name of security group to authorize

            • ‘UserId’<~String> - Name of owner to authorize

        • ‘IpProtocol’<~String> - Ip protocol, must be in [‘tcp’, ‘udp’, ‘icmp’]

        • ‘IpRanges’<~Array>:

          • ip_range<~Hash>:

            • ‘CidrIp’<~String> - CIDR range

        • ‘ToPort’<~Integer> - End of port range (or -1 for ICMP wildcard)

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - success?

Amazon API Reference



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/fog/aws/requests/compute/revoke_security_group_egress.rb', line 42

def revoke_security_group_egress(group_name, options = {})
  options = Fog::AWS.parse_security_group_options(group_name, options)

  if ip_permissions = options.delete('IpPermissions')
    options.merge!(indexed_ip_permissions_params(ip_permissions))
  end

  request({
    'Action'    => 'RevokeSecurityGroupEgress',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::Basic.new
  }.merge!(options))
end

#revoke_security_group_ingress(group_name, options = {}) ⇒ Object

Remove permissions from a security group

Parameters

  • group_name<~String> - Name of group, optional (can also be specified as GroupName in options)

  • options<~Hash>:

    • ‘GroupName’<~String> - Name of security group to modify

    • ‘GroupId’<~String> - Id of security group to modify

    • ‘SourceSecurityGroupName’<~String> - Name of security group to authorize

    • ‘SourceSecurityGroupOwnerId’<~String> - Name of owner to authorize

    or

    • ‘CidrIp’<~String> - CIDR range

    • ‘FromPort’<~Integer> - Start of port range (or -1 for ICMP wildcard)

    • ‘IpProtocol’<~String> - Ip protocol, must be in [‘tcp’, ‘udp’, ‘icmp’]

    • ‘ToPort’<~Integer> - End of port range (or -1 for ICMP wildcard)

    or

    • ‘IpPermissions’<~Array>:

      • permission<~Hash>:

        • ‘FromPort’<~Integer> - Start of port range (or -1 for ICMP wildcard)

        • ‘Groups’<~Array>:

          • group<~Hash>:

            • ‘GroupName’<~String> - Name of security group to authorize

            • ‘UserId’<~String> - Name of owner to authorize

        • ‘IpProtocol’<~String> - Ip protocol, must be in [‘tcp’, ‘udp’, ‘icmp’]

        • ‘IpRanges’<~Array>:

          • ip_range<~Hash>:

            • ‘CidrIp’<~String> - CIDR range

        • ‘ToPort’<~Integer> - End of port range (or -1 for ICMP wildcard)

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • ‘return’<~Boolean> - success?

Amazon API Reference



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/fog/aws/requests/compute/revoke_security_group_ingress.rb', line 42

def revoke_security_group_ingress(group_name, options = {})
  options = Fog::AWS.parse_security_group_options(group_name, options)

  if ip_permissions = options.delete('IpPermissions')
    options.merge!(indexed_ip_permissions_params(ip_permissions))
  end

  request({
    'Action'    => 'RevokeSecurityGroupIngress',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::Basic.new
  }.merge!(options))
end

#run_instances(image_id, min_count, max_count, options = {}) ⇒ Object

Launch specified instances

Parameters

  • image_id<~String> - Id of machine image to load on instances

  • min_count<~Integer> - Minimum number of instances to launch. If this exceeds the count of available instances, no instances will be launched. Must be between 1 and maximum allowed for your account (by default the maximum for an account is 20)

  • max_count<~Integer> - Maximum number of instances to launch. If this exceeds the number of available instances, the largest possible number of instances above min_count will be launched instead. Must be between 1 and maximum allowed for you account (by default the maximum for an account is 20)

  • options<~Hash>:

    • ‘Placement.AvailabilityZone’<~String> - Placement constraint for instances

    • ‘Placement.GroupName’<~String> - Name of existing placement group to launch instance into

    • ‘Placement.Tenancy’<~String> - Tenancy option in [‘dedicated’, ‘default’], defaults to ‘default’

    • ‘BlockDeviceMapping’<~Array>: array of hashes

      • ‘DeviceName’<~String> - where the volume will be exposed to instance

      • ‘VirtualName’<~String> - volume virtual device name

      • ‘Ebs.SnapshotId’<~String> - id of snapshot to boot volume from

      • ‘Ebs.VolumeSize’<~String> - size of volume in GiBs required unless snapshot is specified

      • ‘Ebs.DeleteOnTermination’<~Boolean> - specifies whether or not to delete the volume on instance termination

      • ‘Ebs.Encrypted’<~Boolean> - specifies whether or not the volume is to be encrypted unless snapshot is specified

      • ‘Ebs.VolumeType’<~String> - Type of EBS volue. Valid options in [‘standard’, ‘io1’] default is ‘standard’.

      • ‘Ebs.Iops’<~String> - The number of I/O operations per second (IOPS) that the volume supports. Required when VolumeType is ‘io1’

    • ‘HibernationOptions’<~Array>: array of hashes

      • ‘Configured’<~Boolean> - specifies whether or not the instance is configured for hibernation. This parameter is valid only if the instance meets the hibernation prerequisites.

    • ‘NetworkInterfaces’<~Array>: array of hashes

      • ‘NetworkInterfaceId’<~String> - An existing interface to attach to a single instance

      • ‘DeviceIndex’<~String> - The device index. Applies both to attaching an existing network interface and creating a network interface

      • ‘SubnetId’<~String> - The subnet ID. Applies only when creating a network interface

      • ‘Description’<~String> - A description. Applies only when creating a network interface

      • ‘PrivateIpAddress’<~String> - The primary private IP address. Applies only when creating a network interface

      • ‘SecurityGroupId’<~Array> or <~String> - ids of security group(s) for network interface. Applies only when creating a network interface.

      • ‘DeleteOnTermination’<~String> - Indicates whether to delete the network interface on instance termination.

      • ‘PrivateIpAddresses.PrivateIpAddress’<~String> - The private IP address. This parameter can be used multiple times to specify explicit private IP addresses for a network interface, but only one private IP address can be designated as primary.

      • ‘PrivateIpAddresses.Primary’<~Bool> - Indicates whether the private IP address is the primary private IP address.

      • ‘SecondaryPrivateIpAddressCount’<~Bool> - The number of private IP addresses to assign to the network interface.

      • ‘AssociatePublicIpAddress’<~String> - Indicates whether to assign a public IP address to an instance in a VPC. The public IP address is assigned to a specific network interface

    • ‘TagSpecifications’<~Array>: array of hashes

      • ‘ResourceType’<~String> - Type of resource to apply tags on, e.g: instance or volume

      • ‘Tags’<~Array> - List of hashes reprensenting tag to be set

        • ‘Key’<~String> - Tag name

        • ‘Value’<~String> - Tag value

    • ‘ClientToken’<~String> - unique case-sensitive token for ensuring idempotency

    • ‘DisableApiTermination’<~Boolean> - specifies whether or not to allow termination of the instance from the api

    • ‘SecurityGroup’<~Array> or <~String> - Name of security group(s) for instances (not supported for VPC)

    • ‘SecurityGroupId’<~Array> or <~String> - id’s of security group(s) for instances, use this or SecurityGroup

    • ‘InstanceInitiatedShutdownBehaviour’<~String> - specifies whether volumes are stopped or terminated when instance is shutdown, in [stop, terminate]

    • ‘InstanceType’<~String> - Type of instance to boot. Valid options in [‘t1.micro’, ‘t2.nano’, ‘t2.micro’, ‘t2.small’, ‘t2.medium’, ‘m1.small’, ‘m1.medium’, ‘m1.large’, ‘m1.xlarge’, ‘c1.medium’, ‘c1.xlarge’, ‘c3.large’, ‘c3.xlarge’, ‘c3.2xlarge’, ‘c3.4xlarge’, ‘c3.8xlarge’, ‘g2.2xlarge’, ‘hs1.8xlarge’, ‘m2.xlarge’, ‘m2.2xlarge’, ‘m2.4xlarge’, ‘cr1.8xlarge’, ‘m3.xlarge’, ‘m3.2xlarge’, ‘hi1.4xlarge’, ‘cc1.4xlarge’, ‘cc2.8xlarge’, ‘cg1.4xlarge’, ‘i2.xlarge’, ‘i2.2xlarge’, ‘i2.4xlarge’, ‘i2.8xlarge’] default is ‘m1.small’

    • ‘KernelId’<~String> - Id of kernel with which to launch

    • ‘KeyName’<~String> - Name of a keypair to add to booting instances

    • ‘Monitoring.Enabled’<~Boolean> - Enables monitoring, defaults to disabled

    • ‘PrivateIpAddress<~String> - VPC option to specify ip address within subnet

    • ‘RamdiskId’<~String> - Id of ramdisk with which to launch

    • ‘SubnetId’<~String> - VPC option to specify subnet to launch instance into

    • ‘UserData’<~String> - Additional data to provide to booting instances

    • ‘EbsOptimized’<~Boolean> - Whether the instance is optimized for EBS I/O

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘groupSet’<~Array>: groups the instances are members in

        • ‘groupName’<~String> - Name of group

      • ‘instancesSet’<~Array>: returned instances

        • instance<~Hash>:

          • ‘amiLaunchIndex’<~Integer> - reference to instance in launch group

          • ‘architecture’<~String> - architecture of image in [i386, x86_64]

          • ‘blockDeviceMapping’<~Array>

            • ‘attachTime’<~Time> - time of volume attachment

            • ‘deleteOnTermination’<~Boolean> - whether or not to delete volume on termination

            • ‘deviceName’<~String> - specifies how volume is exposed to instance

            • ‘status’<~String> - status of attached volume

            • ‘volumeId’<~String> - Id of attached volume

          • ‘hibernationOptions’<~Array>

            • ‘configured’<~Boolean> - whether or not the instance is enabled for hibernation

          • ‘dnsName’<~String> - public dns name, blank until instance is running

          • ‘imageId’<~String> - image id of ami used to launch instance

          • ‘instanceId’<~String> - id of the instance

          • ‘instanceState’<~Hash>:

            • ‘code’<~Integer> - current status code

            • ‘name’<~String> - current status name

          • ‘instanceType’<~String> - type of instance

          • ‘ipAddress’<~String> - public ip address assigned to instance

          • ‘kernelId’<~String> - Id of kernel used to launch instance

          • ‘keyName’<~String> - name of key used launch instances or blank

          • ‘launchTime’<~Time> - time instance was launched

          • ‘monitoring’<~Hash>:

            • ‘state’<~Boolean - state of monitoring

          • ‘placement’<~Hash>:

            • ‘availabilityZone’<~String> - Availability zone of the instance

          • ‘privateDnsName’<~String> - private dns name, blank until instance is running

          • ‘privateIpAddress’<~String> - private ip address assigned to instance

          • ‘productCodes’<~Array> - Product codes for the instance

          • ‘ramdiskId’<~String> - Id of ramdisk used to launch instance

          • ‘reason’<~String> - reason for most recent state transition, or blank

          • ‘rootDeviceName’<~String> - specifies how the root device is exposed to the instance

          • ‘rootDeviceType’<~String> - root device type used by AMI in [ebs, instance-store]

          • ‘ebsOptimized’<~Boolean> - Whether the instance is optimized for EBS I/O

      • ‘ownerId’<~String> - Id of owner

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

      • ‘reservationId’<~String> - Id of reservation

Amazon API Reference



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/fog/aws/requests/compute/run_instances.rb', line 115

def run_instances(image_id, min_count, max_count, options = {})
  if block_device_mapping = options.delete('BlockDeviceMapping')
    block_device_mapping.each_with_index do |mapping, index|
      for key, value in mapping
        options.merge!({ format("BlockDeviceMapping.%d.#{key}", index) => value })
      end
    end
  end
  if hibernation_options = options.delete('HibernationOptions')
    hibernation_options.each_with_index do |mapping, index|
      for key, value in mapping
        options.merge!({ format("HibernationOptions.%d.#{key}", index) => value })
      end
    end
  end
  if security_groups = options.delete('SecurityGroup')
    options.merge!(Fog::AWS.indexed_param('SecurityGroup', [*security_groups]))
  end
  if security_group_ids = options.delete('SecurityGroupId')
    options.merge!(Fog::AWS.indexed_param('SecurityGroupId', [*security_group_ids]))
  end
  if options['UserData']
    options['UserData'] = Base64.encode64(options['UserData'])
  end
  if network_interfaces = options.delete('NetworkInterfaces')
    network_interfaces.each_with_index do |mapping, index|
      iface = format("NetworkInterface.%d", index)
      for key, value in mapping
        case key
        when "SecurityGroupId"
          options.merge!(Fog::AWS.indexed_param("#{iface}.SecurityGroupId", [*value]))
        else
          options.merge!({ "#{iface}.#{key}" => value })
        end
      end
    end
  end
  if tag_specifications = options.delete('TagSpecifications')
    # From https://docs.aws.amazon.com/sdk-for-ruby/v2/api/Aws/EC2/Client.html#run_instances-instance_method
    # And https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html
    # Discussed at https://github.com/fog/fog-aws/issues/603
    #
    # Example
    #
    # TagSpecifications: [
    #     {
    #       ResourceType: "instance",
    #       Tags: [
    #         {
    #           Key: "Project",
    #           Value: "MyProject",
    #         },
    #       ],
    #     },
    #     {
    #       ResourceType: "volume",
    #       Tags: [
    #         {
    #           Key: "Project",
    #           Value: "MyProject",
    #         },
    #       ],
    #     },
    # ]
    tag_specifications.each_with_index do |val, idx|
      resource_type = val["ResourceType"]
      tags = val["Tags"]
      options["TagSpecification.#{idx}.ResourceType"] = resource_type
      tags.each_with_index do |tag, tag_idx|
        aws_tag_key = "TagSpecification.#{idx}.Tag.#{tag_idx}.Key"
        aws_tag_value = "TagSpecification.#{idx}.Tag.#{tag_idx}.Value"
        options[aws_tag_key] = tag["Key"]
        options[aws_tag_value] = tag["Value"]
      end
    end
  end

  idempotent = !(options['ClientToken'].nil? || options['ClientToken'].empty?)

  request({
    'Action'    => 'RunInstances',
    'ImageId'   => image_id,
    'MinCount'  => min_count,
    'MaxCount'  => max_count,
    :idempotent => idempotent,
    :parser     => Fog::Parsers::AWS::Compute::RunInstances.new
  }.merge!(options))
end

#start_instances(instance_id) ⇒ Object

Start specified instance

Parameters

  • instance_id<~Array> - Id of instance to start

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • TODO: fill in the blanks

Amazon API Reference



19
20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/compute/start_instances.rb', line 19

def start_instances(instance_id)
  params = Fog::AWS.indexed_param('InstanceId', instance_id)
  request({
    'Action'    => 'StartInstances',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::StartStopInstances.new
  }.merge!(params))
end

#stop_instances(instance_id, options = {}) ⇒ Object

Stop specified instance

Parameters

  • instance_id<~Array> - Id of instance to start

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • TODO: fill in the blanks

Amazon API Reference



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fog/aws/requests/compute/stop_instances.rb', line 19

def stop_instances(instance_id, options = {})
  params = Fog::AWS.indexed_param('InstanceId', instance_id)
  unless options.is_a?(Hash)
    Fog::Logger.warning("stop_instances with #{options.class} param is deprecated, use stop_instances('force' => boolean) instead [light_black](#{caller.first})[/]")
    options = {'force' => options}
  end
  params.merge!('Force' => 'true') if options['force']
  if options['hibernate']
    params.merge!('Hibernate' => 'true')
    params.merge!('Force' => 'false')
  end
  request({
    'Action'    => 'StopInstances',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::StartStopInstances.new
  }.merge!(params))
end

#supported_platformsObject



184
185
186
# File 'lib/fog/aws/compute.rb', line 184

def supported_platforms
  .body["accountAttributeSet"].find{ |h| h["attributeName"] == "supported-platforms" }["values"]
end

#terminate_instances(instance_id) ⇒ Object

Terminate specified instances

Parameters

  • instance_id<~Array> - Ids of instances to terminates

Returns

# * response<~Excon::Response>:

* body<~Hash>:
  * 'requestId'<~String> - Id of request
  * 'instancesSet'<~Array>:
    * 'instanceId'<~String> - id of the terminated instance
    * 'previousState'<~Hash>: previous state of instance
      * 'code'<~Integer> - previous status code
      * 'name'<~String> - name of previous state
    * 'shutdownState'<~Hash>: shutdown state of instance
      * 'code'<~Integer> - current status code
      * 'name'<~String> - name of current state

Amazon API Reference



26
27
28
29
30
31
32
33
# File 'lib/fog/aws/requests/compute/terminate_instances.rb', line 26

def terminate_instances(instance_id)
  params = Fog::AWS.indexed_param('InstanceId', instance_id)
  request({
    'Action'    => 'TerminateInstances',
    :idempotent => true,
    :parser     => Fog::Parsers::AWS::Compute::TerminateInstances.new
  }.merge!(params))
end

#unmonitor_instances(instance_ids) ⇒ Object

UnMonitor specified instance docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-UnmonitorInstances.html

Parameters

  • instance_ids<~Array> - Arrays of instances Ids to monitor

Returns

Amazon API Reference



20
21
22
23
24
25
26
27
# File 'lib/fog/aws/requests/compute/unmonitor_instances.rb', line 20

def unmonitor_instances(instance_ids)
  params = Fog::AWS.indexed_param('InstanceId', instance_ids)
  request({
                  'Action' => 'UnmonitorInstances',
                  :idempotent => true,
                  :parser => Fog::Parsers::AWS::Compute::MonitorUnmonitorInstances.new
          }.merge!(params))
end