AWS CLI 【EC2】
阿新 • • 發佈:2018-11-07
#啟動例項(此例項已建立完畢)
aws ec2 start-instances --instance-ids i-1234567890abcdef0
#啟動例項(新建立一個例項)
aws ec2 run-instances --image-id ami-0f77bf77 --count 1 --instance-type t2.small --key-name dragon --security-group-ids sg-c239ddb8 sg-7b987c01 --subnet-id subnet-63c4c504 --no-associate-public-ip-address --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=test}]'
註明:
--image-id ami-0f77bf77 #需要使用啟動的映象id --count 1 #需要啟動幾臺例項 --instance-type t2.small #例項型別 --key-name syavingc #key的名字 --security-group-ids sg-c239ddb8 sg-7b987c01 #安全組id --subnet-id subnet-63c4c504 #子網id --no-associate-public-ip-address #沒有公有IP --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=test}]' #標籤
#建立映象
aws ec2 create-image --instance-id i-08d5a59aa3211ee98 --name "test" --description "testnode" --no-reboot
註明:
--instance-id i-08d5a59aa3211ee98 #需要建立映象的ec2id --name "test" #映象的名字 --description "testnode" #映象的描述 --no-reboot #不需要重啟ec2例項