aws ec2 describe-spot-instance-requests
Describes the specified Spot Instance requests. AWS CLI reference
3 examples 5 options Its page in the AWS CLI reference
Examples
Example 1: To describe a Spot Instance request
The following describe-spot-instance-requests example describes the specified Spot Instance request.
aws ec2 describe-spot-instance-requests --spot-instance-request-ids sir-08b93456Identify--spot-instance-request-idsThe IDs of the Spot Instance requests.Its output, shortened
{
"SpotInstanceRequests": [
{
"CreateTime": "2018-04-30T18:14:55.000Z",
"InstanceId": "i-1234567890abcdef1",
"LaunchSpecification": {
"InstanceType": "t2.micro",
"ImageId": "ami-003634241a8fcdec0",
"KeyName": "my-key-pair",
"SecurityGroups": [
{
"GroupName": "default",
"GroupId": "sg-e38f24a7"
}
],
"BlockDeviceMappings": [
{
"DeviceName": "/dev/sda1",
"Ebs": {
"DeleteOnTermination": true,
"SnapshotId": "snap-0e54a519c999adbbd",
"VolumeSize": 8,
"VolumeType": "standard",
"Encrypted": false
}
}
],
"NetworkInterfaces": [
{
"DeleteOnTermination": true,
… 28 more linesExample 2: To describe Spot Instance requests based on filters
The following describe-spot-instance-requests example uses filters to scope the results to Spot Instance requests with the specified instance type in the specified Availability Zone. The example uses the --query parameter to display only the instance IDs.
aws ec2 describe-spot-instance-requests --filters Name=launch.instance-type,Values=m3.medium Name=launched-availability-zone,Values=us-west-2a --query "SpotInstanceRequests[*].[InstanceId]" --output textIdentify--filtersThe filters.--queryA JMESPath query to use in filtering the response data.--outputThe formatting style for command output.Its output
[
[
"i-057750d42936e468a"
],
[
"i-001efd250faaa6ffa"
],
[
"i-027552a73f021f3bd"
],
...
]For additional examples using filters, see Listing and filtering your resources in the Amazon Elastic Compute Cloud User Guide.
Example 3: To describe Spot Instance requests based on tags
The following describe-spot-instance-requests example uses tag filters to scope the results to Spot Instance requests that have the tag cost-center=cc123.
aws ec2 describe-spot-instance-requests --filters Name=tag:cost-center,Values=cc123Identify--filtersThe filters.Its output, shortened
{
"SpotInstanceRequests": [
{
"CreateTime": "2018-04-30T18:14:55.000Z",
"InstanceId": "i-1234567890abcdef2",
"LaunchSpecification": {
"InstanceType": "t2.micro",
"ImageId": "ami-003634241a8fcdec0",
"KeyName": "my-key-pair",
"SecurityGroups": [
{
"GroupName": "default",
"GroupId": "sg-e38f24a7"
}
],
"Placement": {
"AvailabilityZone": "us-west-2b",
"Tenancy": "default"
},
"Monitoring": {
"Enabled": false
}
},
"LaunchedAvailabilityZone": "us-west-2b",
"ProductDescription": "Linux/UNIX",
"SpotInstanceRequestId": "sir-0a1b2c3d",
"SpotPrice": "0.010000",
"State": "active",
"Status": {
"Code": "fulfilled",
… 14 more linesFor additional examples using tag filters, see Working with tags in the Amazon EC2 User Guide.
Options
--dry-runChecks whether you have the required permissions for the action, without actually making the request, and provides an error response.--filtersThe filters.--max-resultsThe maximum number of items to return for this request.--next-tokenThe token returned from a previous paginated request.--spot-instance-request-idsThe IDs of the Spot Instance requests.