Search code examples
linuxamazon-web-servicesamazon-ec2automationcommand-line-interface

How can i mention shutdown behaviour on instance by aws command line interface commands. please assists


Here is my aws cli command for launching ec2 instance, these cli command working succesfully.

    aws ec2 run-instance --region ap-south-1 \
    --count 1 \
    --image-id myamiid \
    --security-group-ids mysgid \
    --subnet-id mysubnetid \
    --key-name mykeypair \
    --instance-type t2.micro \
    --tag-specification 'ResourceType=instance,Tags=[{Key=Name,Value=Myinstance}]'

i need shutdown behaviour command when lauching the instance, please assist to correct the below command on run-instance

--instanceInitiatedShutdownBehavior=terminate \

Solution

  • Use:

    --instance-initiated-shutdown-behavior=terminate