Skip to content

Instantly share code, notes, and snippets.

@anuragmathur1
Created September 7, 2017 04:07
Show Gist options
  • Save anuragmathur1/a5048d2d9248830af87b0d75dacb369c to your computer and use it in GitHub Desktop.
Save anuragmathur1/a5048d2d9248830af87b0d75dacb369c to your computer and use it in GitHub Desktop.
Create ec2 instance using aws cli.
aws ec2 run-instances \
--image-id ami-xxxxxxxx \
--instance-type m4.large \
--security-group-ids sg-xxxxxxxx sg-xxxxxxxx sg-xxxxxxxx \
--subnet-id subnet-xxxxxxxx \
--iam-instance-profile Arn=arn:aws:iam::xxxxxxxxxxxx:instance-profile/instance-profile \
--count 1 \
--block-device-mappings '[ { "DeviceName": "/dev/xvda", "Ebs": {"VolumeSize": 100, "VolumeType": "gp2"}}]' \
--key-name instance-key \
--associate-public-ip-address \
--profile=work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment