Object
deprecation
Initialize connection to EC2
options parameter must include values for :aws_access_key_id and :aws_secret_access_key in order to create a connection
sdb = SimpleDB.new( :aws_access_key_id => your_aws_access_key_id, :aws_secret_access_key => your_aws_secret_access_key )
options<~Hash> - config arguments for connection. Defaults to {}.
region<~String> - optional region to use, in
aws_session_token<~String> - when using Session Tokens or Federated Users, a session_token must be presented
EC2 object with connection to aws.
# File lib/fog/aws/compute.rb, line 257 def initialize(options={}) require 'fog/core/parser' @aws_access_key_id = options[:aws_access_key_id] @aws_secret_access_key = options[:aws_secret_access_key] @aws_session_token = options[:aws_session_token] @connection_options = options[:connection_options] || {} @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key) @region = options[:region] ||= 'us-east-1' if @endpoint = options[:endpoint] endpoint = URI.parse(@endpoint) @host = endpoint.host @path = endpoint.path @port = endpoint.port @scheme = endpoint.scheme else @host = options[:host] || case options[:region] when 'ap-northeast-1' 'ec2.ap-northeast-1.amazonaws.com' when 'ap-southeast-1' 'ec2.ap-southeast-1.amazonaws.com' when 'eu-west-1' 'ec2.eu-west-1.amazonaws.com' when 'us-east-1' 'ec2.us-east-1.amazonaws.com' when 'us-west-1' 'ec2.us-west-1.amazonaws.com' when 'us-west-2' 'ec2.us-west-2.amazonaws.com' when 'sa-east-1' 'ec2.sa-east-1.amazonaws.com' else raise ArgumentError, "Unknown region: #{options[:region].inspect}" end @path = options[:path] || '/' @persistent = options[:persistent] || false @port = options[:port] || 443 @scheme = options[:scheme] || 'https' end @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) end
Acquire an elastic IP address.
response<~Excon::Response>:
body<~Hash>:
'publicIp'<~String> - The acquired address
'requestId'<~String> - Id of the request
# File lib/fog/aws/requests/compute/allocate_address.rb, line 17 def allocate_address request( 'Action' => 'AllocateAddress', :parser => Fog::Parsers::Compute::AWS::AllocateAddress.new ) end
Associate an elastic IP address with an instance
instance_id<~String> - Id of instance to associate address with
public_ip<~String> - Public ip to assign to instance
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
'return'<~Boolean> - success?
# File lib/fog/aws/requests/compute/associate_address.rb, line 21 def associate_address(instance_id, public_ip) request( 'Action' => 'AssociateAddress', 'InstanceId' => instance_id, 'PublicIp' => public_ip, :idempotent => true, :parser => Fog::Parsers::Compute::AWS::Basic.new ) end
Attach an Amazon EBS volume with a running instance, exposing as specified device
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")
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
# File lib/fog/aws/requests/compute/attach_volume.rb, line 26 def attach_volume(instance_id, volume_id, device) request( 'Action' => 'AttachVolume', 'VolumeId' => volume_id, 'InstanceId' => instance_id, 'Device' => device, :idempotent => true, :parser => Fog::Parsers::Compute::AWS::AttachVolume.new ) end
Terminate specified spot instance requests
spot_instance_request_id<~Array> - Ids of instances to terminates
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
# File lib/fog/aws/requests/compute/cancel_spot_instance_requests.rb, line 22 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::Compute::AWS::CancelSpotInstanceRequests.new }.merge!(params)) end
Create a bootable EBS volume AMI
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
response<~Excon::Response>:
body<~Hash>:
'imageId'<~String> - The ID of the created AMI.
'requestId'<~String> - Id of request.
# File lib/fog/aws/requests/compute/create_image.rb, line 23 def create_image(instance_id, name, description, no_reboot = false) request( 'Action' => 'CreateImage', 'InstanceId' => instance_id, 'Name' => name, 'Description' => description, 'NoReboot' => no_reboot.to_s, :parser => Fog::Parsers::Compute::AWS::CreateImage.new ) end
Create a new key pair
key_name<~String> - Unique name for key pair.
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
# File lib/fog/aws/requests/compute/create_key_pair.rb, line 22 def create_key_pair(key_name) request( 'Action' => 'CreateKeyPair', 'KeyName' => key_name, :parser => Fog::Parsers::Compute::AWS::CreateKeyPair.new ) end
Create a new placement group
group_name<~String> - Name of the placement group.
strategy<~String> - Placement group strategy. Valid options in ['cluster']
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
'return'<~Boolean> - success?
# File lib/fog/aws/requests/compute/create_placement_group.rb, line 21 def create_placement_group(name, strategy) request( 'Action' => 'CreatePlacementGroup', 'GroupName' => name, 'Strategy' => strategy, :parser => Fog::Parsers::Compute::AWS::Basic.new ) end
Create a new security group
group_name<~String> - Name of the security group.
group_description<~String> - Description of group.
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
'return'<~Boolean> - success?
# File lib/fog/aws/requests/compute/create_security_group.rb, line 21 def create_security_group(name, description) request( 'Action' => 'CreateSecurityGroup', 'GroupName' => name, 'GroupDescription' => description, :parser => Fog::Parsers::Compute::AWS::Basic.new ) end
Create a snapshot of an EBS volume and store it in S3
volume_id<~String> - Id of EBS volume to snapshot
response<~Excon::Response>:
body<~Hash>:
'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
# 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::Compute::AWS::CreateSnapshot.new ) end
Create a spot datafeed subscription
bucket<~String> - bucket name to store datafeed in
prefix<~String> - prefix to store data with
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
# File lib/fog/aws/requests/compute/create_spot_datafeed_subscription.rb, line 28 def create_spot_datafeed_subscription(bucket, prefix) request( 'Action' => 'CreateSpotDatafeedSubscription', 'Bucket' => bucket, 'Prefix' => prefix, :idempotent => true, :parser => Fog::Parsers::Compute::AWS::SpotDatafeedSubscription.new ) end
Create an EBS volume
availability_zone<~String> - availability zone to create volume in
size<~Integer> - Size in GiBs for volume. Must be between 1 and 1024.
snapshot_id<~String> - Optional, snapshot to create volume from
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's<~String> - State of volume
'volumeId'<~String> - Reference to volume
# File lib/fog/aws/requests/compute/create_volume.rb, line 26 def create_volume(availability_zone, size, snapshot_id = nil) request( 'Action' => 'CreateVolume', 'AvailabilityZone' => availability_zone, 'Size' => size, 'SnapshotId' => snapshot_id, :parser => Fog::Parsers::Compute::AWS::CreateVolume.new ) end
Delete a key pair that you own
key_name<~String> - Name of the key pair.
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> id of request
'return'<~Boolean> - success?
# File lib/fog/aws/requests/compute/delete_key_pair.rb, line 20 def delete_key_pair(key_name) request( 'Action' => 'DeleteKeyPair', 'KeyName' => key_name, :idempotent => true, :parser => Fog::Parsers::Compute::AWS::Basic.new ) end
Delete a placement group that you own
group_name<~String> - Name of the placement group.
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
'return'<~Boolean> - success?
# File lib/fog/aws/requests/compute/delete_placement_group.rb, line 20 def delete_placement_group(name) request( 'Action' => 'DeletePlacementGroup', 'GroupName' => name, :idempotent => true, :parser => Fog::Parsers::Compute::AWS::Basic.new ) end
Delete a security group that you own
group_name<~String> - Name of the security group.
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
'return'<~Boolean> - success?
# File lib/fog/aws/requests/compute/delete_security_group.rb, line 20 def delete_security_group(name) request( 'Action' => 'DeleteSecurityGroup', 'GroupName' => name, :idempotent => true, :parser => Fog::Parsers::Compute::AWS::Basic.new ) end
Delete a snapshot of an EBS volume that you own
snapshot_id<~String> - ID of snapshot to delete
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
'return'<~Boolean> - success?
# File lib/fog/aws/requests/compute/delete_snapshot.rb, line 20 def delete_snapshot(snapshot_id) request( 'Action' => 'DeleteSnapshot', 'SnapshotId' => snapshot_id, :idempotent => true, :parser => Fog::Parsers::Compute::AWS::Basic.new ) end
Delete a spot datafeed subscription
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> id of request
'return'<~Boolean> - success?
# File lib/fog/aws/requests/compute/delete_spot_datafeed_subscription.rb, line 17 def delete_spot_datafeed_subscription request( 'Action' => 'DeleteSpotDatafeedSubscription', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::Basic.new ) end
Delete an EBS volume
volume_id<~String> - Id of volume to delete.
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
'return'<~Boolean> - success?
# File lib/fog/aws/requests/compute/delete_volume.rb, line 20 def delete_volume(volume_id) request( 'Action' => 'DeleteVolume', 'VolumeId' => volume_id, :idempotent => true, :parser => Fog::Parsers::Compute::AWS::Basic.new ) end
deregister an image
image_id<~String> - Id of image to deregister
response<~Excon::Response>:
body<~Hash>:
'return'<~Boolean> - Returns true if deregistration succeeded
'requestId'<~String> - Id of request
# File lib/fog/aws/requests/compute/deregister_image.rb, line 20 def deregister_image(image_id) request( 'Action' => 'DeregisterImage', 'ImageId' => image_id, :parser => Fog::Parsers::Compute::AWS::DeregisterImage.new ) end
Describe all or specified IP addresses.
filters<~Hash> - List of filters to limit results with
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
'addressesSet'<~Array>:
'instanceId'<~String> - instance for ip address
'publicIp'<~String> - ip address for instance
# File lib/fog/aws/requests/compute/describe_addresses.rb, line 22 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::Compute::AWS::DescribeAddresses.new }.merge!(params)) end
Describe all or specified availability zones
filters<~Hash> - List of filters to limit results with
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
# File lib/fog/aws/requests/compute/describe_availability_zones.rb, line 23 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 = {'public-ip' => [*filters]} end params = Fog::AWS.indexed_filters(filters) request({ 'Action' => 'DescribeAvailabilityZones', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::DescribeAvailabilityZones.new }.merge!(params)) end
Describe all or specified images.
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.
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
# File lib/fog/aws/requests/compute/describe_images.rb, line 42 def describe_images(filters = {}) options = {} for key in ['ExecutableBy', 'ImageId', 'Owner'] 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' => 'DescribeImages', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::DescribeImages.new }.merge!(params)) end
# File lib/fog/aws/requests/compute/describe_instance_status.rb, line 8 def describe_instance_status(filters = {}) raise ArgumentError.new("Filters must be a hash, but is a #{filters.class}.") unless filters.is_a?(Hash) params = Fog::AWS.indexed_filters(filters) request({ 'Action' => 'DescribeInstanceStatus', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::DescribeInstanceStatus.new }.merge!(params)) end
Describe all or specified instances
filters<~Hash> - List of filters to limit results with
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
'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
'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
# File lib/fog/aws/requests/compute/describe_instances.rb, line 56 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 = {} 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.merge!(Fog::AWS.indexed_filters(filters)) request({ 'Action' => 'DescribeInstances', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::DescribeInstances.new }.merge!(params)) end
Describe all or specified key pairs
filters<~Hash> - List of filters to limit results with
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
'keySet'<~Array>:
'keyName'<~String> - Name of key
'keyFingerprint'<~String> - Fingerprint of key
# File lib/fog/aws/requests/compute/describe_key_pairs.rb, line 22 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::Compute::AWS::DescribeKeyPairs.new }.merge!(params)) end
Describe all or specified placement groups
filters<~Hash> - List of filters to limit results with
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
# File lib/fog/aws/requests/compute/describe_placement_groups.rb, line 23 def describe_placement_groups(filters = {}) params = Fog::AWS.indexed_filters(filters) request({ 'Action' => 'DescribePlacementGroups', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::DescribePlacementGroups.new }.merge!(params)) end
Describe all or specified regions
filters<~Hash> - List of filters to limit results with
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
'regionInfo'<~Array>:
'regionName'<~String> - Name of region
'regionEndpoint'<~String> - Service endpoint for region
# File lib/fog/aws/requests/compute/describe_regions.rb, line 22 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::Compute::AWS::DescribeRegions.new }.merge!(params)) end
Describe all or specified reserved instances
filters<~Hash> - List of filters to limit results with
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
'reservedInstancesId'<~String> - id of the instance
'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
# File lib/fog/aws/requests/compute/describe_reserved_instances.rb, line 30 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::Compute::AWS::DescribeReservedInstances.new }.merge!(params)) end
Describe all or specified reserved instances offerings
filters<~Hash> - List of filters to limit results with
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
'instanceType'<~String> - instance type of offering
'productDescription'<~String> - description of offering
'reservedInstancesOfferingId'<~String> - id of offering
'usagePrice'<~Float> - usage price of offering, per hour
# File lib/fog/aws/requests/compute/describe_reserved_instances_offerings.rb, line 27 def describe_reserved_instances_offerings(filters = {}) params = Fog::AWS.indexed_filters(filters) request({ 'Action' => 'DescribeReservedInstancesOfferings', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::DescribeReservedInstancesOfferings.new }.merge!(params)) end
Describe all or specified security groups
filters<~Hash> - List of filters to limit results with
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
'toPort'<~Integer> - End of port range (or -1 for ICMP wildcard)
'ownerId'<~String> - AWS Access Key Id of the owner of the security group
# File lib/fog/aws/requests/compute/describe_security_groups.rb, line 33 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 params = Fog::AWS.indexed_filters(filters) request({ 'Action' => 'DescribeSecurityGroups', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::DescribeSecurityGroups.new }.merge!(params)) end
Describe all or specified snapshots
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
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
'snapshotSet'<~Array>:
'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
# 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.has_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::Compute::AWS::DescribeSnapshots.new }.merge!(params)) end
Describe spot datafeed subscription
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
# File lib/fog/aws/requests/compute/describe_spot_datafeed_subscription.rb, line 24 def describe_spot_datafeed_subscription request({ 'Action' => 'DescribeSpotDatafeedSubscription', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::SpotDatafeedSubscription.new }) end
Describe all or specified spot instance requests
filters<~Hash> - List of filters to limit results with
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
'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
# 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::Compute::AWS::SpotInstanceRequests.new }.merge!(params)) end
Describe all or specified spot price history
filters<~Hash> - List of filters to limit results with
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
# File lib/fog/aws/requests/compute/describe_spot_price_history.rb, line 25 def describe_spot_price_history(filters = {}) params = Fog::AWS.indexed_filters(filters) request({ 'Action' => 'DescribeSpotPriceHistory', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::DescribeSpotPriceHistory.new }.merge!(params)) end
Describe all or specified volumes.
filters<~Hash> - List of filters to limit results with
response<~Excon::Response>:
body<~Hash>:
'volumeSet'<~Array>:
'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
'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
# File lib/fog/aws/requests/compute/describe_volumes.rb, line 32 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::Compute::AWS::DescribeVolumes.new }.merge!(params)) end
Detach an Amazon EBS volume from a running instance
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
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
# File lib/fog/aws/requests/compute/detach_volume.rb, line 28 def detach_volume(volume_id, options = {}) request({ 'Action' => 'DetachVolume', 'VolumeId' => volume_id, :idempotent => true, :parser => Fog::Parsers::Compute::AWS::DetachVolume.new }.merge!(options)) end
Disassociate an elastic IP address from its instance (if any)
public_ip<~String> - Public ip to assign to instance
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
'return'<~Boolean> - success?
# File lib/fog/aws/requests/compute/disassociate_address.rb, line 20 def disassociate_address(public_ip) request( 'Action' => 'DisassociateAddress', 'PublicIp' => public_ip, :idempotent => true, :parser => Fog::Parsers::Compute::AWS::Basic.new ) end
Retrieve console output for specified instance
instance_id<~String> - Id of instance to get console output from
# * 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
# File lib/fog/aws/requests/compute/get_console_output.rb, line 22 def get_console_output(instance_id) request( 'Action' => 'GetConsoleOutput', 'InstanceId' => instance_id, :idempotent => true, :parser => Fog::Parsers::Compute::AWS::GetConsoleOutput.new ) end
Retrieves the encrypted administrator password for an instance running Windows.
instance_id<~String> - A Windows instance ID
# * 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
# File lib/fog/aws/requests/compute/get_password_data.rb, line 24 def get_password_data(instance_id) request( 'Action' => 'GetPasswordData', 'InstanceId' => instance_id, :idempotent => true, :parser => Fog::Parsers::Compute::AWS::GetPasswordData.new ) end
Import an existing public key to create a new key pair
key_name<~String> - Unique name for key pair.
public_key_material<~String> - RSA public key
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
# File lib/fog/aws/requests/compute/import_key_pair.rb, line 22 def import_key_pair(key_name, public_key_material) request( 'Action' => 'ImportKeyPair', 'KeyName' => key_name, 'PublicKeyMaterial' => Base64::encode64(public_key_material), :parser => Fog::Parsers::Compute::AWS::ImportKeyPair.new ) end
Modify image attributes
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
# File lib/fog/aws/requests/compute/modify_image_attribute.rb, line 22 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::Compute::AWS::Basic.new }.merge!(params)) end
# File lib/fog/aws/compute.rb, line 96 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 attributes
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)
# File lib/fog/aws/requests/compute/modify_instance_attribute.rb, line 24 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::Compute::AWS::Basic.new }.merge!(params)) end
# File lib/fog/aws/requests/compute/modify_instance_attribute.rb, line 36 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 snapshot attributes
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
# File lib/fog/aws/requests/compute/modify_snapshot_attribute.rb, line 20 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::Compute::AWS::Basic.new }.merge!(params)) end
Monitor specified instance docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-MonitorInstances.html
instance_ids<~Array> - Arrays of instances Ids to monitor
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
'instancesSet': docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemType-MonitorInstancesResponseSetItemType.html
# File lib/fog/aws/requests/compute/monitor_instances.rb, line 22 def monitor_instances(instance_ids) params = Fog::AWS.indexed_param('InstanceId', instance_ids) request({ 'Action' => 'MonitorInstances', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::MonitorUnmonitorInstances.new }.merge!(params)) end
Purchases a Reserved Instance for use with your account.
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.
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
'reservedInstancesId'<~String> - Id of the purchased reserved instances.
# File lib/fog/aws/requests/compute/purchase_reserved_instances_offering.rb, line 21 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::Compute::AWS::PurchaseReservedInstancesOffering.new }) end
Reboot specified instances
instance_id<~Array> - Ids of instances to reboot
# * response<~Excon::Response>:
* body<~Hash>: * 'requestId'<~String> - Id of request * 'return'<~Boolean> - success?
# File lib/fog/aws/requests/compute/reboot_instances.rb, line 20 def reboot_instances(instance_id = []) params = Fog::AWS.indexed_param('InstanceId', instance_id) request({ 'Action' => 'RebootInstances', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::Basic.new }.merge!(params)) end
# 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::Compute::AWS::RegisterImage.new } # This determines if we are doing a snapshot or a S3 backed AMI. if(location =~ /^\/dev\/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 an elastic IP address.
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
'return'<~Boolean> - success?
# File lib/fog/aws/requests/compute/release_address.rb, line 17 def release_address(public_ip) request( 'Action' => 'ReleaseAddress', 'PublicIp' => public_ip, :idempotent => true, :parser => Fog::Parsers::Compute::AWS::Basic.new ) end
# File lib/fog/aws/compute.rb, line 300 def reload @connection.reset end
Launch specified instances
'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.Placement.AvailabilityZone'<~String> - Placement constraint for instances
'LaunchSpecification.SecurityGroup'<~Array> or <~String> - Name of security group(s) for instances
'LaunchSpecification.UserData'<~String> - Additional data to provide to booting instances
'Type'<~String> - spot instance request type in ['one-time', 'persistent']
'ValidFrom'<~Time> - start date for request
'ValidUntil'<~Time> - end date for request
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
'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
# File lib/fog/aws/requests/compute/request_spot_instances.rb, line 56 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 options['LaunchSpecification.UserData'] options['LaunchSpecification.UserData'] = Base64.encode64(options['LaunchSpecification.UserData']) end request({ 'Action' => 'RequestSpotInstances', 'LaunchSpecification.ImageId' => image_id, 'LaunchSpecification.InstanceType' => instance_type, 'SpotPrice' => spot_price, :parser => Fog::Parsers::Compute::AWS::SpotInstanceRequests.new }.merge!(options)) end
Remove permissions from a security group
group_name<~String> - Name of group
options<~Hash>:
'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)
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
'return'<~Boolean> - success?
# File lib/fog/aws/requests/compute/revoke_security_group_ingress.rb, line 41 def revoke_security_group_ingress(group_name, options = {}) if group_name.is_a?(Hash) Fog::Logger.deprecation("Fog::AWS::Compute#revoke_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]") options = group_name group_name = options.delete('GroupName') end if ip_permissions = options.delete('IpPermissions') options.merge!(indexed_ip_permissions_params(ip_permissions)) end request({ 'Action' => 'RevokeSecurityGroupIngress', 'GroupName' => group_name, :idempotent => true, :parser => Fog::Parsers::Compute::AWS::Basic.new }.merge!(options)) end
Launch specified instances
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'<~String> - specifies whether or not to delete the volume on instance termination
'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 (you must omit this parameter if using Virtual Private Clouds)
'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', 'm1.small', 'm1.large', 'm1.xlarge', 'c1.medium', 'c1.xlarge', 'm2.xlarge', m2.2xlarge', 'm2.4xlarge', 'cc1.4xlarge', 'cg1.4xlarge'] 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
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
'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]
'ownerId'<~String> - Id of owner
'requestId'<~String> - Id of request
'reservationId'<~String> - Id of reservation
# File lib/fog/aws/requests/compute/run_instances.rb, line 89 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 security_groups = options.delete('SecurityGroup') options.merge!(Fog::AWS.indexed_param('SecurityGroup', [*security_groups])) end if options['UserData'] options['UserData'] = Base64.encode64(options['UserData']) 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::Compute::AWS::RunInstances.new }.merge!(options)) end
Start specified instance
instance_id<~Array> - Id of instance to start
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
TODO: fill in the blanks
# File lib/fog/aws/requests/compute/start_instances.rb, line 20 def start_instances(instance_id) params = Fog::AWS.indexed_param('InstanceId', instance_id) request({ 'Action' => 'StartInstances', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::StartStopInstances.new }.merge!(params)) end
Stop specified instance
instance_id<~Array> - Id of instance to start
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
TODO: fill in the blanks
# File lib/fog/aws/requests/compute/stop_instances.rb, line 20 def stop_instances(instance_id, force = false) params = Fog::AWS.indexed_param('InstanceId', instance_id) params.merge!('Force' => 'true') if force request({ 'Action' => 'StopInstances', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::StartStopInstances.new }.merge!(params)) end
Terminate specified instances
instance_id<~Array> - Ids of instances to terminates
# * 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
# File lib/fog/aws/requests/compute/terminate_instances.rb, line 27 def terminate_instances(instance_id) params = Fog::AWS.indexed_param('InstanceId', instance_id) request({ 'Action' => 'TerminateInstances', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::TerminateInstances.new }.merge!(params)) end
UnMonitor specified instance docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-UnmonitorInstances.html
instance_ids<~Array> - Arrays of instances Ids to monitor
response<~Excon::Response>:
body<~Hash>:
'requestId'<~String> - Id of request
'instancesSet': docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemType-MonitorInstancesResponseSetItemType.html
# File lib/fog/aws/requests/compute/unmonitor_instances.rb, line 22 def unmonitor_instances(instance_ids) params = Fog::AWS.indexed_param('InstanceId', instance_ids) request({ 'Action' => 'UnmonitorInstances', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::MonitorUnmonitorInstances.new }.merge!(params)) end
Generated with the Darkfish Rdoc Generator 2.