Class: Aws::EC2::Image
- Inherits:
-
Object
- Object
- Aws::EC2::Image
- Extended by:
- Deprecations
- Defined in:
- sig/image.rbs,
lib/aws-sdk-ec2/image.rb
Overview
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#architecture ⇒ String
The architecture of the image.
-
#block_device_mappings ⇒ Array<Types::BlockDeviceMapping>
Any block device mapping entries.
-
#boot_mode ⇒ String
The boot mode of the image.
-
#creation_date ⇒ String
The date and time the image was created.
-
#deprecation_time ⇒ String
The date and time to deprecate the AMI, in UTC, in the following format: YYYY-MM-DDTHH:MM:SSZ.
-
#deregistration_protection ⇒ String
Indicates whether deregistration protection is enabled for the AMI.
-
#description ⇒ String
The description of the AMI that was provided during image creation.
-
#ena_support ⇒ Boolean
Specifies whether enhanced networking with ENA is enabled.
-
#free_tier_eligible ⇒ Boolean
Indicates whether the image is eligible for Amazon Web Services Free Tier.
-
#hypervisor ⇒ String
The hypervisor type of the image.
- #id ⇒ String (also: #image_id)
-
#image_allowed ⇒ Boolean
If
true, the AMI satisfies the criteria for Allowed AMIs and can be discovered and used in the account. -
#image_location ⇒ String
The location of the AMI.
-
#image_owner_alias ⇒ String
The owner alias (
amazon|aws-backup-vault|aws-marketplace). -
#image_type ⇒ String
The type of image.
-
#image_watermarks ⇒ Array<Types::ImageWatermark>
The watermarks attached to the AMI.
-
#imds_support ⇒ String
If
v2.0, it indicates that IMDSv2 is specified in the AMI. -
#kernel_id ⇒ String
The kernel associated with the image, if any.
-
#last_launched_time ⇒ String
The date and time, in [ISO 8601 date-time format][1], when the AMI was last used to launch an EC2 instance.
-
#name ⇒ String
The name of the AMI that was provided during image creation.
-
#owner_id ⇒ String
The ID of the Amazon Web Services account that owns the image.
-
#platform ⇒ String
This value is set to
windowsfor Windows AMIs; otherwise, it is blank. -
#platform_details ⇒ String
The platform details associated with the billing code of the AMI.
-
#product_codes ⇒ Array<Types::ProductCode>
Any product codes associated with the AMI.
-
#public ⇒ Boolean
Indicates whether the image has public launch permissions.
-
#ramdisk_id ⇒ String
The RAM disk associated with the image, if any.
-
#root_device_name ⇒ String
The device name of the root device volume (for example,
/dev/sda1). -
#root_device_type ⇒ String
The type of root device used by the AMI.
-
#source_image_id ⇒ String
The ID of the source AMI from which the AMI was created.
-
#source_image_region ⇒ String
The Region of the source AMI.
-
#source_instance_id ⇒ String
The ID of the instance that the AMI was created from if the AMI was created using [CreateImage][1].
-
#sriov_net_support ⇒ String
Specifies whether enhanced networking with the Intel 82599 Virtual Function interface is enabled.
-
#state ⇒ String
The current state of the AMI.
-
#state_reason ⇒ Types::StateReason
The reason for the state change.
-
#tags ⇒ Array<Types::Tag>
Any tags assigned to the image.
-
#tpm_support ⇒ String
If the image is configured for NitroTPM support, the value is
v2.0. -
#usage_operation ⇒ String
The operation of the Amazon EC2 instance and the billing code that is associated with the AMI.
-
#virtualization_type ⇒ String
The type of virtualization of the AMI.
Actions collapse
- #create_tags(options = {}) ⇒ Tag::Collection
- #delete_tags(options = {}) ⇒ Tag::Collection
- #deregister(options = {}) ⇒ Types::DeregisterImageResult
- #describe_attribute(options = {}) ⇒ Types::ImageAttribute
- #identifiers ⇒ Object deprecated private Deprecated.
- #modify_attribute(options = {}) ⇒ EmptyStructure
- #reset_attribute(options = {}) ⇒ EmptyStructure
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::Image
Returns the data for this Image.
-
#data_loaded? ⇒ Boolean
Returns
trueif this resource is loaded. -
#exists?(options = {}) ⇒ Boolean
Returns
trueif the Image exists. -
#initialize(*args) ⇒ Image
constructor
A new instance of Image.
- #load ⇒ self (also: #reload)
-
#wait_until(options = {}) {|resource| ... } ⇒ Resource
deprecated
Deprecated.
Use [Aws::EC2::Client] #wait_until instead
- #wait_until_exists(options = {}, &block) ⇒ Image
Constructor Details
Instance Method Details
#architecture ⇒ String
The architecture of the image.
118 |
# File 'sig/image.rbs', line 118
def architecture: () -> ("i386" | "x86_64" | "arm64" | "x86_64_mac" | "arm64_mac")
|
#block_device_mappings ⇒ Array<Types::BlockDeviceMapping>
Any block device mapping entries.
28 |
# File 'sig/image.rbs', line 28
def block_device_mappings: () -> ::Array[Types::BlockDeviceMapping]
|
#boot_mode ⇒ String
The boot mode of the image. For more information, see Instance launch behavior with Amazon EC2 boot modes in the Amazon EC2 User Guide.
64 |
# File 'sig/image.rbs', line 64
def boot_mode: () -> ("legacy-bios" | "uefi" | "uefi-preferred")
|
#create_tags(options = {}) ⇒ Tag::Collection
153 |
# File 'sig/image.rbs', line 153
def create_tags: (
|
#creation_date ⇒ String
The date and time the image was created.
109 |
# File 'sig/image.rbs', line 109
def creation_date: () -> ::String
|
#data ⇒ Types::Image
Returns the data for this Aws::EC2::Image. Calls
Client#describe_images if #data_loaded? is false.
139 |
# File 'sig/image.rbs', line 139
def data: () -> Types::Image
|
#data_loaded? ⇒ Boolean
142 |
# File 'sig/image.rbs', line 142
def data_loaded?: () -> bool
|
#delete_tags(options = {}) ⇒ Tag::Collection
165 |
# File 'sig/image.rbs', line 165
def delete_tags: (
|
#deprecation_time ⇒ String
The date and time to deprecate the AMI, in UTC, in the following format: YYYY-MM-DDTHH:MM:SSZ. If you specified a value for seconds, Amazon EC2 rounds the seconds to the nearest minute.
70 |
# File 'sig/image.rbs', line 70
def deprecation_time: () -> ::String
|
#deregister(options = {}) ⇒ Types::DeregisterImageResult
177 |
# File 'sig/image.rbs', line 177
def deregister: (
|
#deregistration_protection ⇒ String
Indicates whether deregistration protection is enabled for the AMI.
79 |
# File 'sig/image.rbs', line 79
def deregistration_protection: () -> ::String
|
#describe_attribute(options = {}) ⇒ Types::ImageAttribute
184 |
# File 'sig/image.rbs', line 184
def describe_attribute: (
|
#description ⇒ String
The description of the AMI that was provided during image creation.
31 |
# File 'sig/image.rbs', line 31
def description: () -> ::String
|
#ena_support ⇒ Boolean
Specifies whether enhanced networking with ENA is enabled.
34 |
# File 'sig/image.rbs', line 34
def ena_support: () -> bool
|
#exists?(options = {}) ⇒ Boolean
Returns true if the Image exists.
145 146 |
# File 'sig/image.rbs', line 145
def exists?: (?max_attempts: Integer, ?delay: Numeric, ?before_attempt: (^(Integer attempts) -> void), ?before_wait: (^(Integer attempts, untyped response) -> void)) -> bool
| (?Hash[Symbol, untyped]) -> bool
|
#free_tier_eligible ⇒ Boolean
Indicates whether the image is eligible for Amazon Web Services Free Tier.
-
If
true, the AMI is eligible for Free Tier and can be used to launch instances under the Free Tier limits. -
If
false, the AMI is not eligible for Free Tier.
94 |
# File 'sig/image.rbs', line 94
def free_tier_eligible: () -> bool
|
#hypervisor ⇒ String
The hypervisor type of the image. Only xen is supported. ovm is
not supported.
37 |
# File 'sig/image.rbs', line 37
def hypervisor: () -> ("ovm" | "xen")
|
#id ⇒ String Also known as: image_id
18 |
# File 'sig/image.rbs', line 18
def id: () -> String
|
#identifiers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
780 781 782 |
# File 'lib/aws-sdk-ec2/image.rb', line 780 def identifiers { id: @id } end |
#image_allowed ⇒ Boolean
If true, the AMI satisfies the criteria for Allowed AMIs and can be
discovered and used in the account. If false and Allowed AMIs is set
to enabled, the AMI can't be discovered or used in the account. If
false and Allowed AMIs is set to audit-mode, the AMI can be
discovered and used in the account.
For more information, see Control the discovery and use of AMIs in Amazon EC2 with Allowed AMIs in Amazon EC2 User Guide.
85 |
# File 'sig/image.rbs', line 85
def image_allowed: () -> bool
|
#image_location ⇒ String
The location of the AMI.
100 |
# File 'sig/image.rbs', line 100
def image_location: () -> ::String
|
#image_owner_alias ⇒ String
The owner alias (amazon | aws-backup-vault | aws-marketplace).
40 |
# File 'sig/image.rbs', line 40
def image_owner_alias: () -> ::String
|
#image_type ⇒ String
The type of image.
121 |
# File 'sig/image.rbs', line 121
def image_type: () -> ("machine" | "kernel" | "ramdisk")
|
#image_watermarks ⇒ Array<Types::ImageWatermark>
The watermarks attached to the AMI.
97 |
# File 'sig/image.rbs', line 97
def image_watermarks: () -> ::Array[Types::ImageWatermark]
|
#imds_support ⇒ String
If v2.0, it indicates that IMDSv2 is specified in the AMI. Instances
launched from this AMI will have HttpTokens automatically set to
required so that, by default, the instance requires that IMDSv2 is
used when requesting instance metadata. In addition,
HttpPutResponseHopLimit is set to 2. For more information, see
Configure the AMI in the Amazon EC2 User Guide.
73 |
# File 'sig/image.rbs', line 73
def imds_support: () -> ("v2.0")
|
#kernel_id ⇒ String
The kernel associated with the image, if any. Only applicable for machine images.
124 |
# File 'sig/image.rbs', line 124
def kernel_id: () -> ::String
|
#last_launched_time ⇒ String
The date and time, in ISO 8601 date-time format, when the AMI was last used to launch an EC2 instance. When the AMI is used to launch an instance, there is a 24-hour delay before that usage is reported.
lastLaunchedTime data is available starting April 2017.
82 |
# File 'sig/image.rbs', line 82
def last_launched_time: () -> ::String
|
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::EC2::Image.
Returns self making it possible to chain methods.
image.reload.data
135 |
# File 'sig/image.rbs', line 135
def load: () -> self
|
#modify_attribute(options = {}) ⇒ EmptyStructure
191 |
# File 'sig/image.rbs', line 191
def modify_attribute: (
|
#name ⇒ String
The name of the AMI that was provided during image creation.
43 |
# File 'sig/image.rbs', line 43
def name: () -> ::String
|
#owner_id ⇒ String
The ID of the Amazon Web Services account that owns the image.
106 |
# File 'sig/image.rbs', line 106
def owner_id: () -> ::String
|
#platform ⇒ String
This value is set to windows for Windows AMIs; otherwise, it is
blank.
130 |
# File 'sig/image.rbs', line 130
def platform: () -> ("Windows")
|
#platform_details ⇒ String
The platform details associated with the billing code of the AMI. For more information, see Understand AMI billing information in the Amazon EC2 User Guide.
22 |
# File 'sig/image.rbs', line 22
def platform_details: () -> ::String
|
#product_codes ⇒ Array<Types::ProductCode>
Any product codes associated with the AMI.
115 |
# File 'sig/image.rbs', line 115
def product_codes: () -> ::Array[Types::ProductCode]
|
#public ⇒ Boolean
Indicates whether the image has public launch permissions. The value
is true if this image has public launch permissions or false if it
has only implicit and explicit launch permissions.
112 |
# File 'sig/image.rbs', line 112
def public: () -> bool
|
#ramdisk_id ⇒ String
The RAM disk associated with the image, if any. Only applicable for machine images.
127 |
# File 'sig/image.rbs', line 127
def ramdisk_id: () -> ::String
|
#reset_attribute(options = {}) ⇒ EmptyStructure
225 |
# File 'sig/image.rbs', line 225
def reset_attribute: (
|
#root_device_name ⇒ String
The device name of the root device volume (for example, /dev/sda1).
46 |
# File 'sig/image.rbs', line 46
def root_device_name: () -> ::String
|
#root_device_type ⇒ String
The type of root device used by the AMI. The AMI can use an Amazon EBS volume or an instance store volume.
49 |
# File 'sig/image.rbs', line 49
def root_device_type: () -> ("ebs" | "instance-store")
|
#source_image_id ⇒ String
The ID of the source AMI from which the AMI was created.
88 |
# File 'sig/image.rbs', line 88
def source_image_id: () -> ::String
|
#source_image_region ⇒ String
The Region of the source AMI.
91 |
# File 'sig/image.rbs', line 91
def source_image_region: () -> ::String
|
#source_instance_id ⇒ String
The ID of the instance that the AMI was created from if the AMI was created using CreateImage. This field only appears if the AMI was created using CreateImage.
76 |
# File 'sig/image.rbs', line 76
def source_instance_id: () -> ::String
|
#sriov_net_support ⇒ String
Specifies whether enhanced networking with the Intel 82599 Virtual Function interface is enabled.
52 |
# File 'sig/image.rbs', line 52
def sriov_net_support: () -> ::String
|
#state ⇒ String
The current state of the AMI. If the state is available, the image
is successfully registered and can be used to launch an instance.
103 |
# File 'sig/image.rbs', line 103
def state: () -> ("pending" | "available" | "invalid" | "deregistered" | "transient" | "failed" | "error" | "disabled")
|
#state_reason ⇒ Types::StateReason
The reason for the state change.
55 |
# File 'sig/image.rbs', line 55
def state_reason: () -> Types::StateReason
|
#tags ⇒ Array<Types::Tag>
Any tags assigned to the image.
58 |
# File 'sig/image.rbs', line 58
def tags: () -> ::Array[Types::Tag]
|
#tpm_support ⇒ String
If the image is configured for NitroTPM support, the value is v2.0.
For more information, see NitroTPM in the Amazon EC2 User
Guide.
67 |
# File 'sig/image.rbs', line 67
def tpm_support: () -> ("v2.0")
|
#usage_operation ⇒ String
The operation of the Amazon EC2 instance and the billing code that is
associated with the AMI. usageOperation corresponds to the
lineitem/Operation column on your Amazon Web Services Cost and
Usage Report and in the Amazon Web Services Price List API. You
can view these fields on the Instances or AMIs pages in the
Amazon EC2 console, or in the responses that are returned by the
DescribeImages command in the Amazon EC2 API, or the
describe-images command in the CLI.
25 |
# File 'sig/image.rbs', line 25
def usage_operation: () -> ::String
|
#virtualization_type ⇒ String
The type of virtualization of the AMI.
61 |
# File 'sig/image.rbs', line 61
def virtualization_type: () -> ("hvm" | "paravirtual")
|
#wait_until(options = {}) {|resource| ... } ⇒ Resource
Use [Aws::EC2::Client] #wait_until instead
The waiting operation is performed on a copy. The original resource remains unchanged.
Waiter polls an API operation until a resource enters a desired state.
Basic Usage
Waiter will polls until it is successful, it fails by entering a terminal state, or until a maximum number of attempts are made.
# polls in a loop until condition is true
resource.wait_until() {|resource| condition}
Example
instance.wait_until(max_attempts:10, delay:5) do |instance|
instance.state.name == 'running'
end
Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. The waiting condition is set by passing a block to #wait_until:
# poll for ~25 seconds
resource.wait_until(max_attempts:5,delay:5) {|resource|...}
Callbacks
You can be notified before each polling attempt and before each
delay. If you throw :success or :failure from these callbacks,
it will terminate the waiter.
started_at = Time.now
# poll for 1 hour, instead of a number of attempts
proc = Proc.new do |attempts, response|
throw :failure if Time.now - started_at > 3600
end
# disable max attempts
instance.wait_until(before_wait:proc, max_attempts:nil) {...}
Handling Errors
When a waiter is successful, it returns the Resource. When a waiter fails, it raises an error.
begin
resource.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
attempts attempt in seconds invoked before each attempt invoked before each wait
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 |
# File 'lib/aws-sdk-ec2/image.rb', line 496 def wait_until( = {}, &block) self_copy = self.dup attempts = 0 [:max_attempts] = 10 unless .key?(:max_attempts) [:delay] ||= 10 [:poller] = Proc.new do attempts += 1 if block.call(self_copy) [:success, self_copy] else self_copy.reload unless attempts == [:max_attempts] :retry end end Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do Aws::Waiters::Waiter.new().wait({}) end end |
#wait_until_exists(options = {}, &block) ⇒ Image
149 150 |
# File 'sig/image.rbs', line 149
def wait_until_exists: (?max_attempts: Integer, ?delay: Numeric, ?before_attempt: (^(Integer attempts) -> void), ?before_wait: (^(Integer attempts, untyped response) -> void)) ?{ (untyped waiter) -> void } -> Image
| (?Hash[Symbol, untyped]) ?{ (untyped waiter) -> void } -> Image
|