简体   繁体   中英

How does one disable SourceDestCheck when creating instances with AWS CLI

It should be possible to disable SourceDestCheck since it is documented "SourceDestCheck -> (boolean)"

but using run-instances with

aws ec2 run-instances ...
--SourceDestCheck false

or

--sourceDestCheck=false

Fails with Unknown options: --SourceDestCheck, false

It seems I can run it later with a modify command

aws ec2 modify-instance-attribute --resource=$INSTANCE_ID --no-source-dest-check

but it should be possible to set that at instantiation. I just can't figure out the actual syntax.

As far as I can tell, you can't set that on initial launch with the AWS CLI. It's not a supported option . You have to call aws ec2 modify-instance-attribute --no-source-dest-check documented here .

As @mark pointed out, this isn't an option in the RunInstances API. I just want to add that the SourceDestCheck in the AWS CLI doc you referenced is an output. If you look closely, it's an attribute of the ENI.

I know this is old but I ran into the same issue today and solved it this way. In the resource block of your terraform file add:

provisioner "local-exec" {
    command = "aws ec2 modify-instance-attribute --no-source-dest-check --instance-id ${self.id}"
}

assuming you have the was cli tools installed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM