Is there a way to verify the syntax of an AWS CLI Command without actually performing any action e.g. verify if the below CLI command to create ec2 instance is correct, including the parameters specified, without actually provisioning the ec2 instance?
The reason I am looking for this is because, I have to test multiple AWS Commands with different options and don't want to provision or impact any resources as a part of testing my commands.
I know there is a validate template option for CloudFormation but trying to find it's equivalent for AWS CLI. The reason I gave the example of CloudFormation validate template option is not to equate the two, but more as an analogy.
aws ec2 run-instances \
--image-id ami-0abcdef1234567890 \
--instance-type t2.micro \
--subnet-id subnet-08fc749671b2d077c \
--security-group-ids sg-0b0384b66d7d692f9 \
--associate-public-ip-address \
--key-name MyKeyPair
From Getting help with the AWS CLI - AWS Command Line Interface:
--dry-run | --no-dry-run
(boolean)
Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response isDryRun-Operation
. Otherwise, it isUnauthorizedOperation
.