aws cli 常用命令(一)

单位老大让我研究一下关于命令行管理 AWS对象,顺便把操作的过程贴出来,以便后期参考:

bogon:~ yuanjicai$ aws ec2 create-vpc --cidr-block 172.10.0.0/16    创建VPC

{

"Vpc": {

"VpcId": "vpc-1c34e475",

"InstanceTenancy": "default",

"State": "pending",

"DhcpOptionsId": "dopt-c1a747a8",

"CidrBlock": "172.10.0.0/16",

"IsDefault": false

}

}

bogon:~ yuanjicai$ aws ec2 describe-vpcs    查看VPC

{

"Vpcs": [

{

"VpcId": "vpc-1c34e475",

"InstanceTenancy": "default",

"State": "available",

"DhcpOptionsId": "dopt-c1a747a8",

"CidrBlock": "172.10.0.0/16",

"IsDefault": false

},

{

"VpcId": "vpc-a95cbdc0",

"InstanceTenancy": "default",

"State": "available",

"DhcpOptionsId": "dopt-c1a747a8",

"CidrBlock": "172.31.0.0/16",

"IsDefault": true

}

]

}

bogon:~ yuanjicai$ aws ec2 describe-availability-zones   查看可用区域

{

"AvailabilityZones": [

{

"State": "available",

"RegionName": "ap-south-1",

"Messages": [],

"ZoneName": "ap-south-1a"

},

{

"State": "available",

"RegionName": "ap-south-1",

"Messages": [],

"ZoneName": "ap-south-1b"

}

]

}

bogon:~ yuanjicai$ aws ec2 create-subnet --vpc-id vpc-1c34e475 --cidr-block 172.10.1.0/24 --availability-zone ap-south-1a  在每个可用区域中创建相应的子网

{

"Subnet": {

"VpcId": "vpc-1c34e475",

"CidrBlock": "172.10.1.0/24",

"State": "pending",

"AvailabilityZone": "ap-south-1a",

"SubnetId": "subnet-c4815dad",

"AvailableIpAddressCount": 251

}

}

bogon:~ yuanjicai$ aws ec2 create-subnet --vpc-id vpc-1c34e475 --cidr-block 172.10.2.0/24 --availability-zone ap-south-1b 在每个可用区域中创建相应的子网

{

"Subnet": {

"VpcId": "vpc-1c34e475",

"CidrBlock": "172.10.2.0/24",

"State": "pending",

"AvailabilityZone": "ap-south-1b",

"SubnetId": "subnet-df839e95",

"AvailableIpAddressCount": 251

}

}

bogon:~ yuanjicai$

bogon:~ yuanjicai$ aws ec2 create-internet-gateway     创建internet网关

{

"InternetGateway": {

"Tags": [],

"InternetGatewayId": "igw-4a35f123",

"Attachments": []

}

}

bogon:~ yuanjicai$ aws ec2 attach-internet-gateway --internet-gateway-id igw-4a35f123 --vpc-id vpc-1c34e475    将internet网关附加到vpc上

bogon:~ yuanjicai$ aws ec2 describe-route-tables   查看路由表

{

"RouteTables": [

{

"Associations": [

{

"RouteTableAssociationId": "rtbassoc-4d846424",

"Main": true,

"RouteTableId": "rtb-2eb75747"

}

],

"RouteTableId": "rtb-2eb75747",

"VpcId": "vpc-a95cbdc0",

"PropagatingVgws": [],

"Tags": [],

"Routes": [

{

"GatewayId": "local",

"DestinationCidrBlock": "172.31.0.0/16",

"State": "active",

"Origin": "CreateRouteTable"

},

{

"GatewayId": "igw-b25abcdb",

"DestinationCidrBlock": "0.0.0.0/0",

"State": "active",

"Origin": "CreateRoute"

}

]

},

{

"Associations": [

{

"RouteTableAssociationId": "rtbassoc-cd0aa2a4",

"Main": true,

"RouteTableId": "rtb-3cd00c55"

}

],

"RouteTableId": "rtb-3cd00c55",

"VpcId": "vpc-1c34e475",

"PropagatingVgws": [],

"Tags": [],

"Routes": [

{

"GatewayId": "local",

"DestinationCidrBlock": "172.10.0.0/16",

"State": "active",

"Origin": "CreateRouteTable"

}

]

}

]

}

bogon:~ yuanjicai$ aws ec2 associate-route-table --route-table-id rtb-3cd00c55 --subnet-id subnet-c4815dad  将创建的子网关联到路由表

{

"AssociationId": "rtbassoc-7b0ea612"

}

bogon:~ yuanjicai$ aws ec2 associate-route-table --route-table-id rtb-3cd00c55 --subnet-id subnet-df839e95

{

"AssociationId": "rtbassoc-720ea61b"

}

bogon:~ yuanjicai$

bogon:~ yuanjicai$ aws ec2 create-route --route-table-id rtb-3cd00c55 --destination-cidr-block 0.0.0.0/0 --gateway-id igw-4a35f123   在路由表中创建相关路由条目

{

"Return": true

}

bogon:~ yuanjicai$ aws ec2 create-key-pair --key-name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KX6BhM3oiWJOT7JMc2SDPK\nU7l4yBW+TiyLRQohPmfJgmcHseHhBEfd2736bKtfZ93ZVu0CgYAOMyS/Q5gQ2vu6rtSa7D8K9TmV\nLIiziHLnR3FOVlX39iiuU02ubCwPsf7/LqBi3UfpjtA0IkNdMQO5TIovFzGgEDkOxTmO8TpyPsgK\nR+m0yjD9KUKEHIsdJUNOodVeBYsxGNrlbAVZLgV1JGnHKilfMQYILvZNC1ZBzFLi+ewlQg==\n-----END RSA PRIVATE KEY-----" > Downloads/aws-mb-personal.pem   将私钥保存在本地,文件名为aws-mb-personal.pem

bogon:~ yuanjicai$ chmod 600 Downloads/aws-mb-personal.pem    为私钥设置权限

bogon:~ yuanjicai$ aws ec2 create-security-group --group-name allow-ssh_web --description "test"  --vpc-id vpc-1c34e475  创建安全组

{

"GroupId": "sg-5aa21533"

}

bogon:~ yuanjicai$ aws ec2 authorize-security-group-ingress --group-id sg-5aa21533 --protocol tcp --port 22 --cidr 0.0.0.0/0  在安全组中创建访问规则

bogon:~ yuanjicai$ aws ec2 describe-security-groups  --query SecurityGroups[*].[GroupName,GroupId,VpcId]  查看安全组

[

[

"allow-ssh_web",

"sg-5aa21533",

"vpc-1c34e475"

],

[

"default",

"sg-50a71039",

"vpc-1c34e475"

],

[

"default",

"sg-f318f49a",

"vpc-a95cbdc0"

]

]

bogon:~ yuanjicai$ aws ec2 describe-security-groups  --group-ids sg-5aa21533   查看安全组的访问规则 

{

"SecurityGroups": [

{

"IpPermissionsEgress": [

{

"IpProtocol": "-1",

"IpRanges": [

{

"CidrIp": "0.0.0.0/0"

}

],

"UserIdGroupPairs": [],

"PrefixListIds": []

}

],

"Description": "test",

"IpPermissions": [

{

"PrefixListIds": [],

"FromPort": 22,

"IpRanges": [

{

"CidrIp": "0.0.0.0/0"

}

],

"ToPort": 22,

"IpProtocol": "tcp",

"UserIdGroupPairs": []

}

],

"GroupName": "allow-ssh_web",

"VpcId": "vpc-1c34e475",

"OwnerId": "632310953995",

"GroupId": "sg-5aa21533"

}

]

}

bogon:~ yuanjicai$

bogon:~ yuanjicai$ aws ec2 run-instances --image-id ami-cacbbea5  --count 1 --instance-type t2.micro  --key-name aws-mb-personal.pem --security-group-ids sg-5aa21533 --subnet-id subnet-df839e95 --associate-public-ip-address   创建实例,指定相关的AMI、数量、类型、密钥、安全组、子网等

{

"OwnerId": "632310953995",

"ReservationId": "r-0be49b2436993213e",

"Groups": [],

"Instances": [

{

"Monitoring": {

"State": "disabled"

},

"PublicDnsName": "",

"RootDeviceType": "ebs",

"State": {

"Code": 0,

"Name": "pending"

},

"EbsOptimized": false,

"LaunchTime": "2016-10-14T13:39:02.000Z",

"PrivateIpAddress": "172.10.2.162",

"ProductCodes": [],

"VpcId": "vpc-1c34e475",

"StateTransitionReason": "",

"InstanceId": "i-01912a2add60e2f97",

"ImageId": "ami-cacbbea5",

"PrivateDnsName": "ip-172-10-2-162.ap-south-1.compute.internal",

"KeyName": "aws-mb-personal.pem",

"SecurityGroups": [

{

"GroupName": "allow-ssh_web",

"GroupId": "sg-5aa21533"

}

],

"ClientToken": "",

"SubnetId": "subnet-df839e95",

"InstanceType": "t2.micro",

"NetworkInterfaces": [

{

"Status": "in-use",

"MacAddress": "0a:2d:73:8d:d5:5d",

"SourceDestCheck": true,

"VpcId": "vpc-1c34e475",

"Description": "",

"NetworkInterfaceId": "eni-f1fb60bc",

"PrivateIpAddresses": [

{

"Primary": true,

"PrivateIpAddress": "172.10.2.162"

}

],

"Attachment": {

"Status": "attaching",

"DeviceIndex": 0,

"DeleteOnTermination": true,

"AttachmentId": "eni-attach-1b6a34a0",

"AttachTime": "2016-10-14T13:39:02.000Z"

},

"Groups": [

{

"GroupName": "allow-ssh_web",

"GroupId": "sg-5aa21533"

}

],

"SubnetId": "subnet-df839e95",

"OwnerId": "632310953995",

"PrivateIpAddress": "172.10.2.162"

}

],

"SourceDestCheck": true,

"Placement": {

"Tenancy": "default",

"GroupName": "",

"AvailabilityZone": "ap-south-1b"

},

"Hypervisor": "xen",

"BlockDeviceMappings": [],

"Architecture": "x86_64",

"StateReason": {

"Message": "pending",

"Code": "pending"

},

"RootDeviceName": "/dev/xvda",

"VirtualizationType": "hvm",

"AmiLaunchIndex": 0

}

]

}

bogon:~ yuanjicai$ aws ec2 describe-instances  --query ‘Reservations[*].Instances[*].[PublicIpAddress, PrivateIpAddress,InstanceId]‘ --output text    查看ec2实例的IP和instance-id

52.66.31.169172.10.2.162i-01912a2add60e2f97

bogon:~ yuanjicai$  aws ec2 create-tags --resources i-01912a2add60e2f97 --tags Key=Name,Value=instance01-mb  将创建的实例标记为 instance01-mb

bogon:~ yuanjicai$ ssh -i Downloads/aws-mb-personal.pem [email protected]   利用本地的私钥访问ec2实例

The authenticity of host ‘52.66.31.169 (52.66.31.169)‘ can‘t be established.

ECDSA key fingerprint is SHA256:upiOwWm7/Zp9zWwze0IaKdy2MoT13xvUbdGsRxbvkK4.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added ‘52.66.31.169‘ (ECDSA) to the list of known hosts.

__|  __|_  )

_|  (     /   Amazon Linux AMI

___|\___|___|

https://aws.amazon.com/amazon-linux-ami/2016.09-release-notes/

1 package(s) needed for security, out of 10 available

Run "sudo yum update" to apply all updates.

-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory

[[email protected] ~]$ sudo su -

[[email protected] ~]# exit

logout

[[email protected] ~]$ exit

logout

Connection to 52.66.31.169 closed.

bogon:~ yuanjicai$

bogon:~ yuanjicai$  aws ec2 stop-instances --instance-id i-01912a2add60e2f97    停止实例

{

"StoppingInstances": [

{

"InstanceId": "i-01912a2add60e2f97",

"CurrentState": {

"Code": 64,

"Name": "stopping"

},

"PreviousState": {

"Code": 16,

"Name": "running"

}

}

]

}

bogon:~ yuanjicai$ aws ec2 describe-instance-status --instance-id i-01912a2add60e2f97   查看实例状态

{

"InstanceStatuses": []

}

bogon:~ yuanjicai$ aws ec2 start-instances --instance-id  i-01912a2add60e2f97   启动实例

{

"StartingInstances": [

{

"InstanceId": "i-01912a2add60e2f97",

"CurrentState": {

"Code": 0,

"Name": "pending"

},

"PreviousState": {

"Code": 80,

"Name": "stopped"

}

}

]

}

bogon:~ yuanjicai$

bogon:~ yuanjicai$ aws ec2 describe-instance-status --instance-id i-01912a2add60e2f97    再次查看实例状态

{

"InstanceStatuses": [

{

"InstanceId": "i-01912a2add60e2f97",

"InstanceState": {

"Code": 16,

"Name": "running"

},

"AvailabilityZone": "ap-south-1b",

"SystemStatus": {

"Status": "initializing",

"Details": [

{

"Status": "initializing",

"Name": "reachability"

}

]

},

"InstanceStatus": {

"Status": "initializing",

"Details": [

{

"Status": "initializing",

"Name": "reachability"

}

]

}

}

]

}

bogon:~ yuanjicai$

bogon:~ yuanjicai$ aws ec2 create-volume --size 50 --availability-zone ap-south-1b --volume-type gp2   创建50G gp2卷

{

"AvailabilityZone": "ap-south-1b",

"Encrypted": false,

"VolumeType": "gp2",

"VolumeId": "vol-02aaed26650c96fe5",

"State": "creating",

"Iops": 150,

"SnapshotId": "",

"CreateTime": "2016-10-18T06:20:43.510Z",

"Size": 50

}

bogon:~ yuanjicai$ aws ec2 create-tags --resources vol-02aaed26650c96fe5 --tags Key=Name,Value=attach-to-instance01-mb 将卷标记为“attach-to-instance01-mb”

bogon:~ yuanjicai$ aws ec2 describe-tags --filters "Name=resource-id,Values=vol-02aaed26650c96fe5"  查看卷

{

"Tags": [

{

"ResourceType": "volume",

"ResourceId": "vol-02aaed26650c96fe5",

"Value": "attach-to-instance01-mb",

"Key": "Name"

}

]

}

bogon:~ yuanjicai$ aws ec2 attach-volume --volume-id vol-02aaed26650c96fe5 --instance-id i-01912a2add60e2f97 --device /dev/sdf    将卷附件到指定的实例上

{

"AttachTime": "2016-10-18T06:28:35.886Z",

"InstanceId": "i-01912a2add60e2f97",

"VolumeId": "vol-02aaed26650c96fe5",

"State": "attaching",

"Device": "/dev/sdf"

}

bogon:~ yuanjicai$ aws ec2 describe-volumes --volume-id vol-02aaed26650c96fe5  查看卷信息

{

"Volumes": [

{

"AvailabilityZone": "ap-south-1b",

"Attachments": [

{

"AttachTime": "2016-10-18T06:28:35.000Z",

"InstanceId": "i-01912a2add60e2f97",

"VolumeId": "vol-02aaed26650c96fe5",

"State": "attached",

"DeleteOnTermination": false,

"Device": "/dev/sdf"

}

],

"Tags": [

{

"Value": "attach-to-instance01-mb",

"Key": "Name"

}

],

"Encrypted": false,

"VolumeType": "gp2",

"VolumeId": "vol-02aaed26650c96fe5",

"State": "in-use",

"Iops": 150,

"SnapshotId": "",

"CreateTime": "2016-10-18T06:20:43.510Z",

"Size": 50

}

]

}

bogon:~ yuanjicai$ aws ec2 detach-volume --volume-id vol-02aaed26650c96fe5   从指定的实例上分离指定的卷

{

"AttachTime": "2016-10-18T06:28:35.000Z",

"InstanceId": "i-01912a2add60e2f97",

"VolumeId": "vol-02aaed26650c96fe5",

"State": "detaching",

"Device": "/dev/sdf"

}

bogon:~ yuanjicai$ aws ec2 delete-volume --volume-id vol-02aaed26650c96fe5   删除指定的卷

bogon:~ yuanjicai$ aws ec2 stop-instances --instance-id i-01912a2add60e2f97    停止实例

{

"StoppingInstances": [

{

"InstanceId": "i-01912a2add60e2f97",

"CurrentState": {

"Code": 64,

"Name": "stopping"

},

"PreviousState": {

"Code": 16,

"Name": "running"

}

}

]

}

bogon:~ yuanjicai$

bogon:~ yuanjicai$ aws ec2 describe-instances | grep -i instanceid

"InstanceId": "i-01912a2add60e2f97",

bogon:~ yuanjicai$ aws ec2 terminate-instances --instance-id i-01912a2add60e2f97    终止指定的实例

{

"TerminatingInstances": [

{

"InstanceId": "i-01912a2add60e2f97",

"CurrentState": {

"Code": 48,

"Name": "terminated"

},

"PreviousState": {

"Code": 80,

"Name": "stopped"

}

}

]

}

bogon:~ yuanjicai$ aws ec2 describe-instances --region "ap-northeast-1" | grep -i instanceid

"InstanceId": "i-0b8fd935a1bdd8deb",

bogon:~ yuanjicai$

bogon:~ yuanjicai$ aws ec2 describe-instances --region "ap-northeast-1" | grep -i status

"Status": "in-use",

"Status": "attached",

"Status": "attached",

bogon:~ yuanjicai$

bogon:~ yuanjicai$ aws ec2 describe-instances --region "ap-northeast-1" | grep -i type

"RootDeviceType": "ebs",

"InstanceType": "t2.micro",

"VirtualizationType": "hvm",

bogon:~ yuanjicai$ aws ec2 modify-instance-attribute --instance-id i-0b8fd935a1bdd8deb --instance-type t2.medium --region "ap-northeast-1"    更改实例类型

bogon:~ yuanjicai$ aws ec2 describe-instances --region "ap-northeast-1" | grep -i type

                    "RootDeviceType": "ebs",

"InstanceType": "t2.medium",

"VirtualizationType": "hvm",

bogon:~ yuanjicai$

bogon:~ yuanjicai$ aws ec2 modify-instance-attribute --instance-id i-0b8fd935a1bdd8deb --groups sg-bf0008db sg-987480ff --region "ap-northeast-1"    更改安全组

bogon:~ yuanjicai$

时间: 2024-10-21 11:02:28

aws cli 常用命令(一)的相关文章

zookeeper cli 常用命令解析

zookeeper CLI 1,查看所有命令 启动zookeeper并使用bin目录下的zkCli.sh连接zookeeper服务器,输入任何zookeeper不能识别的命令,zookeeper都会列出所有可供使用的命令: [zk: 127.0.0.1:2184(CONNECTED) 105] k ZooKeeper -server host:port cmd args stat path [watch] set path data [version] ls path [watch] delqu

AWS CLI 命令参数学习 如何使用 --query 选项筛选输出

AWS CLI 使用 --query 选项提供内置输出筛选功能.为演示其工作方式,我们首先来看看下面的默认 JSON 输出,它描述了连接到不同 EC2 实例的两个 EBS (Elastic Block Storage) 卷. $ aws ec2 describe-volumes { "Volumes": [ { "AvailabilityZone": "us-west-2a", "Attachments": [ { "

Linux学习笔记<一>——常用命令

CLI(Command Line Interface)中的命令格式: 命令 选项 参数 command options... arguments... 选项:短选项:-character 多个选项可以组合,如-a -b=-ab 长选项:--word 参数:命令的作用对象 控制类型: 通过虚拟终端:Ctrl+Alt+F1-F6 通过终端模拟器:在GUI中点击打开的终端 通过Telnet或SSH远程接入 GUI(Graphical User Interface)和CLI(Command Line I

npm 常用命令详解

npm是什么 NPM的全称是Node Package Manager,是随同NodeJS一起安装的包管理和分发工具,它很方便让JavaScript开发者下载.安装.上传以及管理已经安装的包. npm install 安装模块 基础语法 npm install (with no args, in package dir) npm install [<@scope>/]<name>npm install [<@scope>/]<name>@<tag>

[Linux 第二天]——Linux的常用命令

经过前面的学习,大概了解了计算机组成原理和操作系统的一些知识.尽管这些知识都是琐碎的,拼凑的,在以后的工作和学习中仍需进行深入的了解.但是这些预备知识对于准备跨入 Linux 大门的童鞋来说,应该是足够了.于是可以愉(ku)快(bi)的敲命令了,这篇文章就来对这几天学习的命令做一个总结. 在开始 Linux 的命令学习之前,不妨回顾一下操作系统有关的知识,这些知识在后面的学习中可能会用到,有必要再次了解. 1.Kernel 内核和系统调用 Kernel 是操作系统的核心,第一天中我们有说道操作系

npm常用命令解析

npm是什么 NPM的全称是Node Package Manager,是随同NodeJS一起安装的包管理和分发工具,它很方便让JavaScript开发者下载.安装.上传以及管理已经安装的包. npm install 安装模块 基础语法 npm install (with no args, in package dir) npm install [<@scope>/]<name> npm install [<@scope>/]<name>@<tag>

linux基础及常用命令的使用

linux系统是一个主要使用命令进行日常工作的系统,所以了解并熟练掌握常用命令的使用是进入linux大门的基本,以下便是linux学习过程中学习的常用的命令的用法: linux的日常管理工作一般有如下几个部分,下面通过这几个方面的管理工作来整理与其相关的常用命令: 一  shell的介绍 1.普通用户需要直接使用计算机系统提供的功能,是非常困难的,因为计算机系统能接收的指令和人发出的指令是不相同的,因此需要在计算机系统及用户之间建立一个可以将相互的指令进行"翻译"的功能.shell就是

【linux_笔记】Linux常用命令

笔记内容均为观看马哥的Linux培训视频教程所得,经本人整理后发布. 知识回顾:    GUI:Graphic User Interface -- 图形用户界面        Windows(Windows桌面)        X-Window(Linux桌面)             Gnome            KDE            Xfce    CLI:Command Line Interface -- 命令行界面        sh(最初的)        bash    

操作系统及常用命令

Linux02 --Linux02_01?操作系统及常用命令 GNU: GNU is Not Unix. GPL: General Public License,通用公共许可证,版权 Copyright, Copyleft 开源协定 LGPL:lesser GPLv2 GPLv3 Shell: GUI: Graphic User Interface Windows X-Window Gnome KDE Xface CLI: Command Line Interface sh bash csh k