查看所有ec2的描述
aws ec2 describe-instance-status查看所有的卷信息
aws ec2 describe-volumes创建安全组
aws ec2 create-security-group –group-name jav –description “Myy Group”安全组里面添加策略
aws ec2 authorize-security-group-ingress –group-name jav –protocol tcp –port 22 –cidr 0.0.0.0/0创建ec2机器
aws ec2 run-instances –key-name mykey –image-id ami-56d4ad31 –count 1 –instance-type t2.micro –security-groups jav –block-device-mapping file:///root/disk.json
{
"DeviceName": "/dev/xvda",
"Ebs": {
"VolumeSize": 33
}
}
- 磁盘扩容
aws ec2 modify-volume --volume-id vol-070a7796c8543f11d --size 44
xxx --volume-type io1 --iops 10000
注意, 磁盘扩容如果是standard的磁盘,也就是标准磁介质的磁盘,是无法从33GB扩容到44GB的,目前测试gp2的磁盘可以在线扩容,可是100GB的磁盘价格大概是standard的两倍。
An error occurred (InvalidParameterValue) when calling the ModifyVolume operation: Volume type EBS Magnetic is not supported.
磁性介质不支持调整属性
[EBS volumes] The volume type, which can be gp2 for General Purpose SSD, io1 for Provisioned IOPS SSD, st1 for Throughput Optimized HDD, sc1 for Cold HDD, or standard for Magnetic. The default value is gp2 in the Amazon EC2 console, and standard in the AWS SDKs and the AWS CLI.
- stop和终止实例
aws ec2 stop-instances --instance-ids i-08e87fd92fb07d3b6
aws ec2 terminate-instances --instance-ids i-08e87fd92fb07d3b6
- key的创建
在网络和安全页面,有创建key的地方,一旦创建,会有一个pem文件被下载下来。
- aws configure的配置
在 右上角,点击自己的名字 > 安全啥的 > 添加一个 ec2full权限的账户就可以操作了。