How to validate EC2::InstanceType? #2444
-
Hello, I need to validate that a string is a valid EC2 instance type. I was hoping code like this would work:
The issue is that the above code will return a seemingly valid InstanceType because GetInstanceTypeForName() uses the EnumParseOverflowContainer, so it will return an InstanceType that is something other than NOT_SET. I'm wondering what the correct way to validate that a string input is a valid InstanceType. Any pointers would be very appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Is there anyone who knows how to validate that a string is a valid instance type? I'm hoping I don't have to write something myself. |
Beta Was this translation helpful? Give feedback.
You can use DescribeInstanceTypeRequest/Response and compare that to your string to see if that is a valid instance. You can look here for examples of how to use that in other languages (sorry we don't currently have an example in c++)