Class: Fog::Compute::AWS::Real
- Inherits:
-
Object
- Object
- Fog::Compute::AWS::Real
- Defined in:
- lib/fog/aws/compute.rb,
lib/fog/aws/compute.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/attach_volume.rb,
lib/fog/aws/requests/compute/create_volume.rb,
lib/fog/aws/requests/compute/delete_volume.rb,
lib/fog/aws/requests/compute/describe_tags.rb,
lib/fog/aws/requests/compute/detach_volume.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_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/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/terminate_instances.rb,
lib/fog/aws/requests/compute/unmonitor_instances.rb,
lib/fog/aws/requests/compute/disassociate_address.rb,
lib/fog/aws/requests/compute/create_security_group.rb,
lib/fog/aws/requests/compute/delete_security_group.rb,
lib/fog/aws/requests/compute/create_placement_group.rb,
lib/fog/aws/requests/compute/delete_placement_group.rb,
lib/fog/aws/requests/compute/modify_image_attribute.rb,
lib/fog/aws/requests/compute/request_spot_instances.rb,
lib/fog/aws/requests/compute/describe_security_groups.rb,
lib/fog/aws/requests/compute/describe_placement_groups.rb,
lib/fog/aws/requests/compute/modify_instance_attribute.rb,
lib/fog/aws/requests/compute/modify_snapshot_attribute.rb,
lib/fog/aws/requests/compute/describe_availability_zones.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/cancel_spot_instance_requests.rb,
lib/fog/aws/requests/compute/revoke_security_group_ingress.rb,
lib/fog/aws/requests/compute/describe_spot_instance_requests.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/describe_spot_datafeed_subscription.rb,
lib/fog/aws/requests/compute/purchase_reserved_instances_offering.rb,
lib/fog/aws/requests/compute/describe_reserved_instances_offerings.rb
Overview
deprecation
Instance Method Summary collapse
-
#allocate_address ⇒ Object
Acquire an elastic IP address.
-
#associate_address(instance_id, public_ip) ⇒ Object
Associate an elastic IP address with an instance.
-
#attach_volume(instance_id, volume_id, device) ⇒ Object
Attach an Amazon EBS volume with a running instance, exposing as specified device.
-
#authorize_security_group_ingress(group_name, options = {}) ⇒ Object
Add permissions to a security group.
-
#cancel_spot_instance_requests(spot_instance_request_id) ⇒ Object
Terminate specified spot instance requests.
-
#create_image(instance_id, name, description, no_reboot = false) ⇒ Object
Create a bootable EBS volume AMI.
-
#create_key_pair(key_name) ⇒ Object
Create a new key pair.
-
#create_placement_group(name, strategy) ⇒ Object
Create a new placement group.
-
#create_security_group(name, description) ⇒ Object
Create a new security group.
-
#create_snapshot(volume_id, description = nil) ⇒ Object
Create a snapshot of an EBS volume and store it in S3.
-
#create_spot_datafeed_subscription(bucket, prefix) ⇒ Object
Create a spot datafeed subscription.
-
#create_tags(resources, tags) ⇒ Object
Adds tags to resources.
-
#create_volume(availability_zone, size, snapshot_id = nil) ⇒ Object
Create an EBS volume.
-
#delete_key_pair(key_name) ⇒ Object
Delete a key pair that you own.
-
#delete_placement_group(name) ⇒ Object
Delete a placement group that you own.
-
#delete_security_group(name) ⇒ Object
Delete a security group that you own.
-
#delete_snapshot(snapshot_id) ⇒ Object
Delete a snapshot of an EBS volume that you own.
-
#delete_spot_datafeed_subscription ⇒ Object
Delete a spot datafeed subscription.
-
#delete_tags(resources, tags) ⇒ Object
Remove tags from resources.
-
#delete_volume(volume_id) ⇒ Object
Delete an EBS volume.
-
#deregister_image(image_id) ⇒ Object
deregister an image.
-
#describe_addresses(filters = {}) ⇒ Object
Describe all or specified IP addresses.
-
#describe_availability_zones(filters = {}) ⇒ Object
Describe all or specified availability zones.
-
#describe_images(filters = {}) ⇒ Object
Describe all or specified images.
-
#describe_instances(filters = {}) ⇒ Object
Describe all or specified instances.
-
#describe_key_pairs(filters = {}) ⇒ Object
Describe all or specified key pairs.
-
#describe_placement_groups(filters = {}) ⇒ Object
Describe all or specified placement groups.
-
#describe_regions(filters = {}) ⇒ Object
Describe all or specified regions.
-
#describe_reserved_instances(filters = {}) ⇒ Object
Describe all or specified reserved instances.
-
#describe_reserved_instances_offerings(filters = {}) ⇒ Object
Describe all or specified reserved instances offerings.
-
#describe_security_groups(filters = {}) ⇒ Object
Describe all or specified security groups.
-
#describe_snapshots(filters = {}, options = {}) ⇒ Object
Describe all or specified snapshots.
-
#describe_spot_datafeed_subscription ⇒ Object
Describe spot datafeed subscription.
-
#describe_spot_instance_requests(filters = {}) ⇒ Object
Describe all or specified spot instance requests.
-
#describe_spot_price_history(filters = {}) ⇒ Object
Describe all or specified spot price history.
-
#describe_tags(filters = {}) ⇒ Object
Describe all or specified tags.
-
#describe_volumes(filters = {}) ⇒ Object
Describe all or specified volumes.
-
#detach_volume(volume_id, options = {}) ⇒ Object
Detach an Amazon EBS volume from a running instance.
-
#disassociate_address(public_ip) ⇒ Object
Disassociate an elastic IP address from its instance (if any).
-
#get_console_output(instance_id) ⇒ Object
Retrieve console output for specified instance.
-
#get_password_data(instance_id) ⇒ Object
Retrieves the encrypted administrator password for an instance running Windows.
-
#import_key_pair(key_name, public_key_material) ⇒ Object
Import an existing public key to create a new key pair.
-
#initialize(options = {}) ⇒ Real
constructor
Initialize connection to EC2.
-
#modify_image_attribute(image_id, attributes) ⇒ Object
Modify image attributes.
- #modify_image_attributes(*params) ⇒ Object
-
#modify_instance_attribute(instance_id, attributes) ⇒ Object
Modify instance attributes.
- #modify_instance_attributes(instance_id, attributes) ⇒ Object
-
#modify_snapshot_attribute(snapshot_id, attributes) ⇒ Object
Modify snapshot attributes.
-
#monitor_instances(instance_ids) ⇒ Object
Monitor specified instance docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-MonitorInstances.html.
-
#purchase_reserved_instances_offering(reserved_instances_offering_id, instance_count = 1) ⇒ Object
Purchases a Reserved Instance for use with your account.
-
#reboot_instances(instance_id = []) ⇒ Object
Reboot specified instances.
- #register_image(name, description, location, block_devices = [], options = {}) ⇒ Object
-
#release_address(public_ip) ⇒ Object
Release an elastic IP address.
- #reload ⇒ Object
-
#request_spot_instances(image_id, instance_type, spot_price, options = {}) ⇒ Object
Launch specified instances.
-
#revoke_security_group_ingress(group_name, options = {}) ⇒ Object
Remove permissions from a security group.
-
#run_instances(image_id, min_count, max_count, options = {}) ⇒ Object
Launch specified instances.
-
#start_instances(instance_id) ⇒ Object
Start specified instance.
-
#stop_instances(instance_id, force = false) ⇒ Object
Stop specified instance.
-
#terminate_instances(instance_id) ⇒ Object
Terminate specified instances.
-
#unmonitor_instances(instance_ids) ⇒ Object
UnMonitor specified instance docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-UnmonitorInstances.html.
Constructor Details
#initialize(options = {}) ⇒ Real
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, in
- ‘eu-west-1’, ‘us-east-1’, ‘us-west-1’, ‘ap-northeast-1’, ‘ap-southeast-1’
-
Returns
-
EC2 object with connection to aws.
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/fog/aws/compute.rb', line 255 def initialize(={}) require 'fog/core/parser' @aws_access_key_id = [:aws_access_key_id] @aws_secret_access_key = [:aws_secret_access_key] @connection_options = [:connection_options] || {} @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key) @region = [:region] ||= 'us-east-1' if @endpoint = [:endpoint] endpoint = URI.parse(@endpoint) @host = endpoint.host @path = endpoint.path @port = endpoint.port @scheme = endpoint.scheme else @host = [:host] || case [: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' else raise ArgumentError, "Unknown region: #{[:region].inspect}" end @path = [:path] || '/' @persistent = [:persistent] || false @port = [:port] || 443 @scheme = [:scheme] || 'https' end @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) end |
Instance Method Details
#allocate_address ⇒ Object
Acquire an elastic IP address.
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘publicIp’<~String> - The acquired address
-
‘requestId’<~String> - Id of the request
-
-
17 18 19 20 21 22 |
# 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_address(instance_id, public_ip) ⇒ Object
Associate an elastic IP address with an instance
Parameters
-
instance_id<~String> - Id of instance to associate address with
-
public_ip<~String> - Public ip to assign to instance
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘requestId’<~String> - Id of request
-
‘return’<~Boolean> - success?
-
-
21 22 23 24 25 26 27 28 29 |
# 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_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
-
-
26 27 28 29 30 31 32 33 34 35 |
# 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 |
#authorize_security_group_ingress(group_name, options = {}) ⇒ Object
Add permissions to a security group
Parameters
-
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’ - CIDR range
-
‘FromPort’ - Start of port range (or -1 for ICMP wildcard)
-
‘GroupName’ - Name of group to modify
-
‘IpProtocol’ - Ip protocol, must be in [‘tcp’, ‘udp’, ‘icmp’]
-
‘ToPort’ - End of port range (or -1 for ICMP wildcard)
-
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘requestId’<~String> - Id of request
-
‘return’<~Boolean> - success?
-
-
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/fog/aws/requests/compute/authorize_security_group_ingress.rb', line 29 def (group_name, = {}) if group_name.is_a?(Hash) Fog::Logger.warning("Fog::AWS::Compute#authorize_security_group_ingress now requires the 'group_name' parameter. Only specifying an options hash is now deprecated [light_black](#{caller.first})[/]") = group_name group_name = ['GroupName'] end request({ 'Action' => 'AuthorizeSecurityGroupIngress', 'GroupName' => group_name, :idempotent => true, :parser => Fog::Parsers::Compute::AWS::Basic.new }.merge!()) 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
-
-
-
22 23 24 25 26 27 28 29 |
# 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_image(instance_id, name, description, no_reboot = false) ⇒ 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.
-
-
23 24 25 26 27 28 29 30 31 32 |
# 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_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
-
-
22 23 24 25 26 27 28 |
# 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_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?
-
-
21 22 23 24 25 26 27 28 |
# 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_security_group(name, description) ⇒ Object
Create a new security group
Parameters
-
group_name<~String> - Name of the security group.
-
group_description<~String> - Description of group.
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘requestId’<~String> - Id of request
-
‘return’<~Boolean> - success?
-
-
21 22 23 24 25 26 27 28 |
# 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_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>:
-
‘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
-
-
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::Compute::AWS::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
-
-
-
28 29 30 31 32 33 34 35 36 |
# 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_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?
-
-
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 21 def (resources, ) resources = [*resources] for key, value in if value.nil? [key] = '' end end params = {} params.merge!(Fog::AWS.indexed_param('ResourceId', resources)) params.merge!(Fog::AWS.indexed_param('Tag.%d.Key', .keys)) params.merge!(Fog::AWS.indexed_param('Tag.%d.Value', .values)) request({ 'Action' => 'CreateTags', :parser => Fog::Parsers::Compute::AWS::Basic.new }.merge!(params)) end |
#create_volume(availability_zone, size, snapshot_id = nil) ⇒ 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.
-
snapshot_id<~String> - Optional, snapshot to create volume from
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’s<~String> - State of volume
-
‘volumeId’<~String> - Reference to volume
-
-
26 27 28 29 30 31 32 33 34 |
# 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_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?
-
-
20 21 22 23 24 25 26 27 |
# 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_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?
-
-
20 21 22 23 24 25 26 27 |
# 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_security_group(name) ⇒ Object
Delete a security group that you own
Parameters
-
group_name<~String> - Name of the security group.
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘requestId’<~String> - Id of request
-
‘return’<~Boolean> - success?
-
-
20 21 22 23 24 25 26 27 |
# 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_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?
-
-
20 21 22 23 24 25 26 27 |
# 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_spot_datafeed_subscription ⇒ Object
Delete a spot datafeed subscription
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘requestId’<~String> id of request
-
‘return’<~Boolean> - success?
-
-
17 18 19 20 21 22 23 |
# 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_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?
-
-
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fog/aws/requests/compute/delete_tags.rb', line 21 def (resources, ) resources = [*resources] params = {} params.merge!(Fog::AWS.indexed_param('ResourceId', resources)) # can not rely on indexed_param because nil values should be omitted .keys.each_with_index do |key, index| index += 1 # should start at 1 instead of 0 params.merge!("Tag.#{index}.Key" => key) unless [key].nil? params.merge("Tag.#{index}.Value" => [key]) end end request({ 'Action' => 'DeleteTags', :parser => Fog::Parsers::Compute::AWS::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?
-
-
20 21 22 23 24 25 26 27 |
# 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_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
-
-
20 21 22 23 24 25 26 |
# 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_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
-
-
-
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/fog/aws/requests/compute/describe_addresses.rb', line 22 def describe_addresses(filters = {}) unless filters.is_a?(Hash) Fog::Logger.warning("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_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
-
-
-
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/fog/aws/requests/compute/describe_availability_zones.rb', line 23 def describe_availability_zones(filters = {}) unless filters.is_a?(Hash) Fog::Logger.warning("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_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
-
-
-
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/fog/aws/requests/compute/describe_images.rb', line 42 def describe_images(filters = {}) = {} for key in ['ExecutableBy', 'ImageId', 'Owner'] if filters.is_a?(Hash) && filters.key?(key) [key] = filters.delete(key) end end params = Fog::AWS.indexed_filters(filters).merge!() request({ 'Action' => 'DescribeImages', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::DescribeImages.new }.merge!(params)) end |
#describe_instances(filters = {}) ⇒ Object
Describe all or specified instances
Parameters
-
filters<~Hash> - List of filters to limit results with
Returns
-
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
-
-
-
-
-
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/fog/aws/requests/compute/describe_instances.rb', line 56 def describe_instances(filters = {}) unless filters.is_a?(Hash) Fog::Logger.warning("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_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
-
-
-
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/fog/aws/requests/compute/describe_key_pairs.rb', line 22 def describe_key_pairs(filters = {}) unless filters.is_a?(Hash) Fog::Logger.warning("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_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
-
-
-
23 24 25 26 27 28 29 30 |
# 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_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
-
-
-
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/fog/aws/requests/compute/describe_regions.rb', line 22 def describe_regions(filters = {}) unless filters.is_a?(Hash) Fog::Logger.warning("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_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
-
‘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
-
-
-
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/fog/aws/requests/compute/describe_reserved_instances.rb', line 30 def describe_reserved_instances(filters = {}) unless filters.is_a?(Hash) Fog::Logger.warning("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_reserved_instances_offerings(filters = {}) ⇒ Object
Describe all or specified reserved instances offerings
Parameters
-
filters<~Hash> - List of filters to limit results with
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
-
‘instanceType’<~String> - instance type of offering
-
‘productDescription’<~String> - description of offering
-
‘reservedInstancesOfferingId’<~String> - id of offering
-
‘usagePrice’<~Float> - usage price of offering, per hour
-
-
-
27 28 29 30 31 32 33 34 |
# 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_security_groups(filters = {}) ⇒ Object
Describe all or specified security groups
Parameters
-
filters<~Hash> - List of filters to limit results with
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘requestId’<~String> - Id of request
-
‘securityGroupInfo’<~Array>:
-
‘groupDescription’<~String> - Description of 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
-
-
-
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fog/aws/requests/compute/describe_security_groups.rb', line 32 def describe_security_groups(filters = {}) unless filters.is_a?(Hash) Fog::Logger.warning("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_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>:
-
‘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
-
-
-
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 = {}, = {}) unless filters.is_a?(Hash) Fog::Logger.warning("describe_snapshots with #{filters.class} param is deprecated, use describe_snapshots('snapshot-id' => []) instead [light_black](#{caller.first})[/]") filters = {'snapshot-id' => [*filters]} end unless .empty? Fog::Logger.warning("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) [key] = filters.delete(key) end end ['RestorableBy'] ||= 'self' params = Fog::AWS.indexed_filters(filters).merge!() request({ 'Action' => 'DescribeSnapshots', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::DescribeSnapshots.new }.merge!(params)) end |
#describe_spot_datafeed_subscription ⇒ Object
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
-
-
-
24 25 26 27 28 29 30 |
# 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_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
-
-
‘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
-
-
-
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::Compute::AWS::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
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
-
-
-
25 26 27 28 29 30 31 32 |
# 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_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
-
-
-
24 25 26 27 28 29 30 31 |
# File 'lib/fog/aws/requests/compute/describe_tags.rb', line 24 def (filters = {}) params = Fog::AWS.indexed_filters(filters) request({ 'Action' => 'DescribeTags', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::DescribeTags.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
-
‘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
-
-
-
-
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fog/aws/requests/compute/describe_volumes.rb', line 32 def describe_volumes(filters = {}) unless filters.is_a?(Hash) Fog::Logger.warning("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_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
-
-
28 29 30 31 32 33 34 35 |
# File 'lib/fog/aws/requests/compute/detach_volume.rb', line 28 def detach_volume(volume_id, = {}) request({ 'Action' => 'DetachVolume', 'VolumeId' => volume_id, :idempotent => true, :parser => Fog::Parsers::Compute::AWS::DetachVolume.new }.merge!()) end |
#disassociate_address(public_ip) ⇒ Object
Disassociate an elastic IP address from its instance (if any)
Parameters
-
public_ip<~String> - Public ip to assign to instance
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘requestId’<~String> - Id of request
-
‘return’<~Boolean> - success?
-
-
20 21 22 23 24 25 26 27 |
# 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 |
#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
22 23 24 25 26 27 28 29 |
# 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 |
#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
24 25 26 27 28 29 30 31 |
# 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_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
-
-
22 23 24 25 26 27 28 29 |
# 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_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
-
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# 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 |
#modify_image_attributes(*params) ⇒ Object
95 96 97 98 |
# File 'lib/fog/aws/compute.rb', line 95 def modify_image_attributes(*params) Fog::Logger.warning("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)
24 25 26 27 28 29 30 31 32 33 34 |
# 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 |
#modify_instance_attributes(instance_id, attributes) ⇒ Object
36 37 38 39 |
# File 'lib/fog/aws/requests/compute/modify_instance_attribute.rb', line 36 def modify_instance_attributes(instance_id, attributes) Fog::Logger.warning("modify_instance_attributes method is deprecated, use 'modify_instance_attribute' instead") modify_instance_attribute(instance_id, attributes) 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
-
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# 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_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
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘requestId’<~String> - Id of request
-
‘instancesSet’: docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemType-MonitorInstancesResponseSetItemType.html
-
-
22 23 24 25 26 27 28 29 |
# 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 |
#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.
-
-
21 22 23 24 25 26 27 28 29 |
# 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_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?
20 21 22 23 24 25 26 27 |
# 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 |
#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=[], ={}) = { '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}$/) ['RootDeviceName'] = location else ['ImageLocation'] = location end block_devices.each_with_index do |bd, index| index += 1 ["DeviceName","VirtualName"].each do |n| ["BlockDeviceMapping.#{index}.#{n}"] = bd[n] if bd[n] end ["SnapshotId","VolumeSize","NoDevice","DeleteOnTermination"].each do |n| ["BlockDeviceMapping.#{index}.Ebs.#{n}"] = bd[n] if bd[n] end end request(.merge!()) end |
#release_address(public_ip) ⇒ Object
Release an elastic IP address.
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘requestId’<~String> - Id of request
-
‘return’<~Boolean> - success?
-
-
17 18 19 20 21 22 23 24 |
# 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 |
#reload ⇒ Object
293 294 295 |
# File 'lib/fog/aws/compute.rb', line 293 def reload @connection.reset 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.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
-
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
-
-
‘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
-
-
-
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/fog/aws/requests/compute/request_spot_instances.rb', line 56 def request_spot_instances(image_id, instance_type, spot_price, = {}) if block_device_mapping = .delete('LaunchSpecification.BlockDeviceMapping') block_device_mapping.each_with_index do |mapping, index| for key, value in mapping .merge!({ format("LaunchSpecification.BlockDeviceMapping.%d.#{key}", index) => value }) end end end if security_groups = .delete('LaunchSpecification.SecurityGroup') .merge!(Fog::AWS.indexed_param('LaunchSpecification.SecurityGroup', [*security_groups])) end if ['LaunchSpecification.UserData'] ['LaunchSpecification.UserData'] = Base64.encode64(['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!()) end |
#revoke_security_group_ingress(group_name, options = {}) ⇒ Object
Remove permissions from a security group
Parameters
-
‘GroupName’<~String> - Name of group
-
options<~Hash>:
-
‘SourceSecurityGroupName’<~String> - Name of security group to authorize
-
‘SourceSecurityGroupOwnerId’<~String> - Name of owner to authorize
or
-
‘CidrIp’ - CIDR range
-
‘FromPort’ - Start of port range (or -1 for ICMP wildcard)
-
‘IpProtocol’ - Ip protocol, must be in [‘tcp’, ‘udp’, ‘icmp’]
-
‘ToPort’ - End of port range (or -1 for ICMP wildcard)
-
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘requestId’<~String> - Id of request
-
‘return’<~Boolean> - success?
-
-
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/fog/aws/requests/compute/revoke_security_group_ingress.rb', line 28 def revoke_security_group_ingress(group_name, = {}) if group_name.is_a?(Hash) Fog::Logger.warning("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})[/]") = group_name group_name = ['GroupName'] end request({ 'Action' => 'RevokeSecurityGroupIngress', 'GroupName' => group_name, :idempotent => true, :parser => Fog::Parsers::Compute::AWS::Basic.new }.merge!()) 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’<~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
-
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
-
-
‘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
-
-
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/fog/aws/requests/compute/run_instances.rb', line 89 def run_instances(image_id, min_count, max_count, = {}) if block_device_mapping = .delete('BlockDeviceMapping') block_device_mapping.each_with_index do |mapping, index| for key, value in mapping .merge!({ format("BlockDeviceMapping.%d.#{key}", index) => value }) end end end if security_groups = .delete('SecurityGroup') .merge!(Fog::AWS.indexed_param('SecurityGroup', [*security_groups])) end if ['UserData'] ['UserData'] = Base64.encode64(['UserData']) end idempotent = !(['ClientToken'].nil? || ['ClientToken'].empty?) request({ 'Action' => 'RunInstances', 'ImageId' => image_id, 'MinCount' => min_count, 'MaxCount' => max_count, :idempotent => idempotent, :parser => Fog::Parsers::Compute::AWS::RunInstances.new }.merge!()) 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
-
-
20 21 22 23 24 25 26 27 |
# 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_instances(instance_id, force = false) ⇒ 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
-
-
20 21 22 23 24 25 26 27 28 |
# 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_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
27 28 29 30 31 32 33 34 |
# 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_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
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘requestId’<~String> - Id of request
-
‘instancesSet’: docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemType-MonitorInstancesResponseSetItemType.html
-
-
22 23 24 25 26 27 28 29 |
# 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 |