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

Class: Aws::EC2::Instance::Collection

Inherits:
Resources::Collection show all
Defined in:
gems/aws-sdk-ec2/lib/aws-sdk-ec2/instance.rb

Batch Actions collapse

Methods inherited from Resources::Collection

#each, #first, #limit, #size

Instance Method Details

#batch_create_tags(options = {}) ⇒ void

This method returns an undefined value.

Examples:

Request syntax with placeholder values


instance.batch_create_tags({
  dry_run: false,
  tags: [ # required
    {
      key: "String",
      value: "String",
    },
  ],
})

Parameters:

  • options ({}) (defaults to: {})

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :tags (required, Array<Types::Tag>)

    One or more tags. The value parameter is required, but if you don't want the tag to have a value, specify the parameter with no value, and we set the value to an empty string.



1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/instance.rb', line 1397

def batch_create_tags(options = {})
  batch_enum.each do |batch|
    params = Aws::Util.copy_hash(options)
    params[:resources] ||= []
    batch.each do |item|
      params[:resources] << {
        id: item.id
      }
    end
    batch[0].client.create_tags(params)
  end
  nil
end

#batch_monitor(options = {}) ⇒ void

This method returns an undefined value.

Examples:

Request syntax with placeholder values


instance.batch_monitor({
  dry_run: false,
})

Parameters:

  • options ({}) (defaults to: {})

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.



1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/instance.rb', line 1423

def batch_monitor(options = {})
  batch_enum.each do |batch|
    params = Aws::Util.copy_hash(options)
    params[:instance_ids] ||= []
    batch.each do |item|
      params[:instance_ids] << {
        id: item.id
      }
    end
    batch[0].client.monitor_instances(params)
  end
  nil
end

#batch_reboot(options = {}) ⇒ void

This method returns an undefined value.

Examples:

Request syntax with placeholder values


instance.batch_reboot({
  dry_run: false,
})

Parameters:

  • options ({}) (defaults to: {})

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.



1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/instance.rb', line 1449

def batch_reboot(options = {})
  batch_enum.each do |batch|
    params = Aws::Util.copy_hash(options)
    params[:instance_ids] ||= []
    batch.each do |item|
      params[:instance_ids] << {
        id: item.id
      }
    end
    batch[0].client.reboot_instances(params)
  end
  nil
end

#batch_start(options = {}) ⇒ void

This method returns an undefined value.

Examples:

Request syntax with placeholder values


instance.batch_start({
  additional_info: "String",
  dry_run: false,
})

Parameters:

  • options ({}) (defaults to: {})

Options Hash (options):

  • :additional_info (String)

    Reserved.

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.



1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/instance.rb', line 1478

def batch_start(options = {})
  batch_enum.each do |batch|
    params = Aws::Util.copy_hash(options)
    params[:instance_ids] ||= []
    batch.each do |item|
      params[:instance_ids] << {
        id: item.id
      }
    end
    batch[0].client.start_instances(params)
  end
  nil
end

#batch_stop(options = {}) ⇒ void

This method returns an undefined value.

Examples:

Request syntax with placeholder values


instance.batch_stop({
  dry_run: false,
  force: false,
})

Parameters:

  • options ({}) (defaults to: {})

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :force (Boolean)

    Forces the instances to stop. The instances do not have an opportunity to flush file system caches or file system metadata. If you use this option, you must perform file system check and repair procedures. This option is not recommended for Windows instances.

    Default: false



1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/instance.rb', line 1512

def batch_stop(options = {})
  batch_enum.each do |batch|
    params = Aws::Util.copy_hash(options)
    params[:instance_ids] ||= []
    batch.each do |item|
      params[:instance_ids] << {
        id: item.id
      }
    end
    batch[0].client.stop_instances(params)
  end
  nil
end

#batch_terminate!(options = {}) ⇒ void

This method returns an undefined value.

Examples:

Request syntax with placeholder values


instance.batch_terminate!({
  dry_run: false,
})

Parameters:

  • options ({}) (defaults to: {})

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.



1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/instance.rb', line 1538

def batch_terminate!(options = {})
  batch_enum.each do |batch|
    params = Aws::Util.copy_hash(options)
    params[:instance_ids] ||= []
    batch.each do |item|
      params[:instance_ids] << {
        id: item.id
      }
    end
    batch[0].client.terminate_instances(params)
  end
  nil
end

#batch_unmonitor(options = {}) ⇒ void

This method returns an undefined value.

Examples:

Request syntax with placeholder values


instance.batch_unmonitor({
  dry_run: false,
})

Parameters:

  • options ({}) (defaults to: {})

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.



1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/instance.rb', line 1564

def batch_unmonitor(options = {})
  batch_enum.each do |batch|
    params = Aws::Util.copy_hash(options)
    params[:instance_ids] ||= []
    batch.each do |item|
      params[:instance_ids] << {
        id: item.id
      }
    end
    batch[0].client.unmonitor_instances(params)
  end
  nil
end