0
0
AWScloud~5 mins

Instance types and families in AWS - Commands & Configuration

Choose your learning style9 modes available
Introduction
Choosing the right virtual computer in the cloud is important. AWS offers different instance types grouped into families. Each family is designed for specific tasks like computing power, memory, or storage. Picking the right one helps your app run well without wasting money.
When you need a virtual server optimized for fast calculations, like running a game server.
When your app needs a lot of memory, such as a database or data analysis tool.
When you want a balance of computing power and memory for general apps.
When you require instances with fast local storage for quick data access.
When you want to save money by choosing smaller instances for light workloads.
Commands
This command lists all AWS EC2 instance types starting with 't3', showing their CPU cores and memory size. It helps you see details of a specific family.
Terminal
aws ec2 describe-instance-types --query 'InstanceTypes[?starts_with(InstanceType, `t3`)].{Type:InstanceType,VCpu:VCpuInfo.DefaultVCpus,Memory:MemoryInfo.SizeInMiB}' --output table
Expected OutputExpected
----------------------------- | DescribeInstanceTypes | |---------------------------| | Type | VCpu | Memory | |-----------|--------|--------| | t3.nano | 2 | 512 | | t3.micro | 2 | 1024 | | t3.small | 2 | 2048 | | t3.medium| 2 | 4096 | | t3.large | 2 | 8192 | -----------------------------
--query - Filters and formats the output to show only needed details.
--output - Sets the output format to a readable table.
This command shows details for the 'm5.large' instance type, including CPU, memory, and storage info in JSON format.
Terminal
aws ec2 describe-instance-types --filters Name=instance-type,Values=m5.large --query 'InstanceTypes[].{Type:InstanceType,VCpu:VCpuInfo.DefaultVCpus,Memory:MemoryInfo.SizeInMiB,Storage:InstanceStorageInfo.TotalSizeInGB}' --output json
Expected OutputExpected
[ { "Type": "m5.large", "VCpu": 2, "Memory": 8192, "Storage": null } ]
--filters - Filters results to only show the specified instance type.
--query - Selects specific fields to display.
--output - Formats output as JSON.
This command lists availability zones where the 'c5.large' instance type is offered, helping you choose where to launch your server.
Terminal
aws ec2 describe-instance-type-offerings --location-type availability-zone --filters Name=instance-type,Values=c5.large --query 'InstanceTypeOfferings[].{Type:InstanceType,Zone:Location}' --output table
Expected OutputExpected
----------------------------- | InstanceType | Zone | |----------------|-----------| | c5.large | us-east-1a| | c5.large | us-east-1b| | c5.large | us-east-1c| -----------------------------
--location-type - Specifies the location type to filter offerings.
--filters - Filters by instance type.
--output - Formats output as a table.
Key Concept

If you remember nothing else from this pattern, remember: AWS instance families group virtual servers by their strengths like CPU, memory, or storage to help you pick the best fit for your app.

Common Mistakes
Trying to launch an instance type not available in the chosen region or zone.
The instance won't start because AWS does not offer it there.
Use 'aws ec2 describe-instance-type-offerings' to check availability before launching.
Choosing an instance type without checking if it has enough memory or CPU for the app.
The app may run slowly or crash due to insufficient resources.
Check instance specs with 'aws ec2 describe-instance-types' to match app needs.
Assuming all instance types have local storage when some do not.
Your app might fail if it expects fast local disk but the instance has none.
Verify storage info in instance details before selecting.
Summary
Use 'aws ec2 describe-instance-types' to see CPU, memory, and storage details of instance families.
Filter instance types by family or name to compare options for your workload.
Check availability zones for your chosen instance type before launching to avoid errors.