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

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

Batch Actions collapse

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.



1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
# File 'lib/aws-sdk-ec2/instance.rb', line 1551

def batch_create_tags(options = {})
  batch_enum.each do |batch|
    params = Aws::Util.copy_hash(options)
    params[:resources] ||= []
    batch.each do |item|
      params[:resources] << 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`.



1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
# File 'lib/aws-sdk-ec2/instance.rb', line 1575

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] << 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`.



1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
# File 'lib/aws-sdk-ec2/instance.rb', line 1599

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] << 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`.



1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
# File 'lib/aws-sdk-ec2/instance.rb', line 1626

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] << 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({
  hibernate: false,
  dry_run: false,
  force: false,
})

Parameters:

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

Options Hash (options):

  • :hibernate (Boolean)

    Hibernates the instance if the instance was enabled for hibernation at launch. If the instance cannot hibernate successfully, a normal shutdown occurs. For more information, see [Hibernate Your Instance] in the *Amazon Elastic Compute Cloud User Guide*.

    Default: ‘false`

    [1]: docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html

  • :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`



1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
# File 'lib/aws-sdk-ec2/instance.rb', line 1670

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] << 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`.



1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
# File 'lib/aws-sdk-ec2/instance.rb', line 1694

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] << 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`.



1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
# File 'lib/aws-sdk-ec2/instance.rb', line 1718

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] << item.id
    end
    batch[0].client.unmonitor_instances(params)
  end
  nil
end