When you purchase an AWS Reserved Instance (RI), you're essentially reserving compute capacity at a discounted rate compared to On-Demand pricing. However, AWS doesn't automatically "assign" RIs to specific instances - they work at the billing level by matching instance attributes.
For an instance to utilize your reserved capacity, it must match these attributes:
{
"InstanceType": "t3.medium",
"AvailabilityZone": "us-east-1a",
"Platform": "Linux/UNIX",
"Tenancy": "default"
}
Use AWS CLI to check your RI coverage:
aws ec2 describe-reserved-instances \
--filters Name=state,Values=active \
--query "ReservedInstances[*].[InstanceType,AvailabilityZone,InstanceCount,State]" \
--output table
Cross-reference with running instances:
aws ec2 describe-instances \
--query 'Reservations[*].Instances[*].[InstanceId,InstanceType,Placement.AvailabilityZone]' \
--output table
Create a CloudWatch alarm to monitor RI utilization:
aws cloudwatch put-metric-alarm \
--alarm-name "RI-Utilization-Low" \
--metric-name "UsedCapacity" \
--namespace "AWS/EC2" \
--statistic "Average" \
--period 300 \
--threshold 80 \
--comparison-operator "LessThanThreshold" \
--evaluation-periods 1 \
--alarm-actions "arn:aws:sns:us-east-1:123456789012:RI-Alerts" \
--dimensions Name=ReservationType,Value=Reserved
When launching a new instance that should utilize your RI:
aws ec2 run-instances \
--image-id ami-0abcdef1234567890 \
--instance-type t3.medium \
--placement AvailabilityZone=us-east-1a \
--tag-specifications 'ResourceType=instance,Tags=[{Key=RI-Match,Value=true}]'
If your instance isn't utilizing the RI, check:
- AZ mismatch (launch in same AZ as your RI)
- Instance type mismatch (must be exact match)
- Platform mismatch (Windows vs. Linux)
- Tenancy setting (default vs. dedicated)
The AWS Cost Explorer provides visualization of your RI usage:
aws ce get-reservation-utilization \
--time-period Start=2023-01-01,End=2023-01-31 \
--granularity=DAILY \
--metrics "UtilizationPercentage" "NetRISavings"
html
When you purchase an Amazon EC2 Reserved Instance (RI), you're essentially reserving capacity at a discounted rate compared to On-Demand pricing. However, AWS doesn't explicitly show whether a running instance is using your reserved capacity. The billing system automatically applies the RI discount to matching instances, but you need to verify proper utilization.
Here are the most reliable ways to confirm RI usage:
1. AWS Cost Explorer
The most straightforward method is to check the AWS Cost Explorer:
aws ce get-reservation-utilization \
--time-period Start=2023-01-01,End=2023-01-31 \
--granularity=DAILY \
--metrics=UtilizationPercentage
2. AWS CLI for RI Coverage
Check your RI coverage using AWS CLI:
aws ec2 describe-reserved-instances \
--filters Name=state,Values=active \
--query 'ReservedInstances[*].[InstanceType,Scope,InstanceCount]'
3. Instance Matching Rules
For an instance to use your RI, it must match these attributes exactly:
- Instance type (e.g., m5.large)
- Platform (Linux/Windows)
- Tenancy (default/dedicated)
- Availability Zone (for Zonal RIs)
- Region (for Regional RIs)
Here's a Python script to check RI coverage for running instances:
import boto3
def check_ri_coverage():
ec2 = boto3.client('ec2')
instances = ec2.describe_instances(Filters=[{'Name': 'instance-state-name', 'Values': ['running']}])
ris = ec2.describe_reserved_instances(Filters=[{'Name': 'state', 'Values': ['active']}])
for reservation in instances['Reservations']:
for instance in reservation['Instances']:
instance_type = instance['InstanceType']
platform = instance.get('Platform', 'linux')
az = instance['Placement']['AvailabilityZone']
for ri in ris['ReservedInstances']:
if (ri['InstanceType'] == instance_type and
ri['ProductDescription'].lower() == platform and
ri['AvailabilityZone'] == az):
print(f"Instance {instance['InstanceId']} matches RI {ri['ReservedInstancesId']}")
break
else:
print(f"Warning: Instance {instance['InstanceId']} has no matching RI")
check_ri_coverage()
If your instances aren't using RIs:
- Verify instance attributes match RI exactly
- Check if RI is in 'active' state
- Confirm RI hasn't expired
- For Regional RIs, ensure instance is in the same region
- Use AWS Instance Size Flexibility for Linux RIs
- Monitor RI utilization weekly
- Set up CloudWatch alarms for RI expiration
- Consider Convertible RIs for long-term flexibility