amazon-web-servicesamazon-ec2aws-cliaws-ebs

Does --instanceType option decide the EBS volume size mounted to EC2?


In the below command:

aws ec2 run-instances --image-id ${VAR1} --key-name ${VAR2} --security-group-ids ${VAR1} \
  --instance-type t2.micro --subnet ${VAR3} --iam-instance-profile Name=whatever

Volume type can be EBS or EFS or whatever.

Does --instance-type t2.micro decide the volume(type & size) mounted to EC2?


Solution

  • Instance type is independent of EBS volume size. Instance type primarily determines the CPU and RAM available to the instance. You would need to specify --block-device-mappings to start an instance with a specific EBS volume size. See this answer for an example.