ec2_volume_info – List EC2 EBS volumes¶
Retrieve information about AWS EC2 EBS volumes.
Examples¶
- name: List all EC2 EBS volumes
ec2_volume_info:
register: result
- name: List a specific EC2 EBS volume
ec2_volume_info:
ids: vol-123asd
register: result
- name: List several EC2 EBS volumes according to their name tag
ec2_volume_info:
names:
- volume-1
- volume-2
register: result
See Also¶
See also
Parameters¶
- auth (optional)
Parameters for authenticating with the AWS service. Each of them may be defined via environment variables.
type: dict- access_key (optional)
The AWS access key ID. If not set, the value of the AWS_ACCESS_KEY environment variable will be checked.
Mutually exclusive with profile.
type: str- profile (optional)
The name of the AWS profile configured with
aws configure
.Can be used instead of explicitly specifying your access credentials and region.
Use
default
to use the default profile.Mutually exclusive with access_key and secret_key.
type: str- region (optional)
The name of the AWS region.
If not set, the value of the AWS_REGION environment variable will be checked.
If you set a profile that specifies a default region, that region is used and you can omit this parameter. Use this parameter to override the profile’s default region.
type: str- secret_key (optional)
The AWS secret access key. If not set, the value of the AWS_SECRET_KEY environment variable will be checked.
Mutually exclusive with profile.
type: str- url (optional)
The URL to the AWS service related to the resource. By default, this is automatically determined through the region parameter.
If not set explicitly, the value of the AWS_<SERVICE>_URL environment variable will be used.
The services currently supported are EC2 and S3.
type: str
- availability_zone (optional)
ID of the availability zone
Limit the results to EBS volumes in the specified availability zone.
type: str- filters (optional)
Filters to use when querying AWS resources. They must be provided as key/value pairs.
Keys and values are case-sensitive and must be strings.
Each key can have multiple values, provided as a list. Within these values, any value must match for the AWS resource to be included.
When multiple filters are provided, the result contains AWS resources matching all of them.
If a filter is specified in
filters
and also in another top-level parameter, the filter in the top-level parameter has precedence. The two are not merged.If a module accepts a top-level parameter for querying the AWS resources, and you also specify the filter it corresponds to via
filters
, the top-level parameter has precedence.type: dict- ids (optional)
Perform the operation for the specified resources.
type: list- names (optional)
Limit the results to the resources with specified names.
type: list- type (optional)
Limit the results to EBS volumes of the specified type.
type: str
Return Values¶
- objects (success), list, {‘objects’: [{‘id’: ‘vol-07bf55269d200d90e’, ‘type’: ‘standard’, ‘size_gib’: 5, ‘availability_zone’: ‘eun1-az1’, ‘tags’: {‘Name’: ‘myfirstvolume’}, ‘state’: ‘available’, ‘attachment’: {‘instance’: ‘i-18fg46a2dsd’, ‘device’: ‘/dev/sdf’, ‘keep_on_termination’: True}}]}
A list of objects representing EC2 EBS volumes.
- id (always), str,
The ID of the volume.
- type (always), str,
The type of the volume.
- size_gib (always), int,
Size of the volume in GiB.
- availability_zone (always), str,
The ID of the availability zone in which the volume exists.
- tags (always), dict,
The tags assigned to this volume.
- state (always), str,
State of the EC2 volume as reported by AWS.
- attachment (when I(state=attached)), dict,
The attachment of this volume to an instance, if any.
- instance (always), str,
The ID of the instance the volume is attached to.
- device (always), str,
Name of the block device under which this volume is available to the instance.
- keep_on_termination (always), bool,
Whether the volume is preserved when terminating the instance.