AWSCLI安装及使用

#69 Amazon AWS Command Line Interface

MARCH 10, 2015

Post Views: 949

In this post I’ll explain how to install and use AWS CLI. It will be a basic document that will be referred in the following posts. We’ll cover installation on Windows, FreeBSD 10.1 and CentOS 7.0. The installation and basic use is trivial.

Contents [hide]

Windows

Go to AWS CLI home-page and download your 64-bit or 32-bit version. Double-click the installer and follow up the prompts. I wanted to do some screenshots, but it’s not worth it. Three time click Next, once InstallFinish and you are done. Open a command prompt and type aws. If you see this, you are all set.


1

2

3


C:\windows\system32>aws

usage: aws [options] <command> <subcommand> [parameters]

aws: error: too few arguments

FreeBSD

The aws cli relies on Python, so if you have Python 2.7 installed, do:


1

pkg install py27-pip

If you don’t have Python installed, use the same command. It will download and install Python 2.7 for you.
If you have a different version, you might want to use the sources.
Then, install aws cli.


1

pip install awscli

CentOS

Same thing, aws relies on Python. CentOS 7 comes with Python installed. Install pip first.


1

2

3

4


yum install wget

wget https://bootstrap.pypa.io/get-pip.py

python get-pip.py

pip install awscli

AWS

Log on to AWS Console and click on Identity & Access Management.

Click on Users and then Create New Users.

Type the username of the first user and make sure that the check mark at the bottom is checked.

Click on Download Credentials and store them somewhere safe. If you lose this file or forget your credentials, you can regenerate the access keys, by selecting the user, clicking on User Actions and then Manage Access Keys.

Now that you have the credentials file downloaded, which is a simple text file, do the following.


1

aws configure

Enter your Access Key IdSecret Access KeyDefault Region Name and the Default output format (text, table, JSON).

Don’t share these keys with anyone. The keys that I am using are for test use, they are gone by now.

Test the CLI.


1

c:\>aws ec2 describe-instances

You should receive this.


1

2


A client error (UnauthorizedOperation) occurred when calling the DescribeInstances operation:

You are not authorized to perform this operation.

Go back to the AWS console and back to IAM menu (Identity and Access Management). Create a new group called Admins or whatever you like.

Attach a Policy. In my case, I’ve selected the top option, thus giving the user full admin rights.

Go back to the Users, select the user, click on User Action and click Add User to Groups. Add the user to the group you’ve just created.

Test the CLI again.


1

c:\>aws ec2 describe-instances

You should see all of your instances, if any.

he default credentials are stored under %UserProfile%\.aws under Windows and ~/.aws under Linux/FreeBSD.

Proxy

If you are behind a firewall and/or you are using proxy, make sure that port 443 (https) is opened. Amazon AWS CLI uses port 443 to execute API calls on the backend. See this pagefor more details and how to configure proxy.
If you are using FreeBSD and csh/tcsh shell use setenv instead of export.


1

setenv HTTP_PROXY http://your-proxy-name-or-IP:your-proxy-port

or


1

setenv HTTPS_PROXY http://your-proxy-name-or-IP:your-proxy-port

Posted in AWSCloud | No Comments

时间: 2024-10-21 19:27:44

AWSCLI安装及使用的相关文章

AWS 命令行界面 + Python 的 AWS 开发工具包 (Boto3)

安装AWS CLI $ pip install awscli 安装Boto3 $ pip install boto3 设置AWS CLI $ aws configure AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY Default region name [None]: us-west-2 Default o

定时关闭AWS上的EC2机器实例

最近一段时间在做一个产品从阿里云向亚马逊云中国区迁移的前期试验.亚马逊中国区并没有开放免费体验账号,使用的每一份资源都要实打实的掏钱.而为了实验我们使用时一般要启动好几台EC2实例.为了不浪费辛辛苦苦赚的钱,特写了一个脚本,在每天晚上6点将所有的EC2实例自动关闭.由于在亚马逊云中关闭的EC2实例是不收费的,只收取少量的存储费用,所以这样节省不少钱. 为了让一台机器可以值守这个任务,所以我们在AWS留一台机器用来定期执行关闭其它机器的命令.关闭EC2的命令主要是使用AWS提供了awscli来实现

aws使用kops方式部署k8s

1.基础准备 yum install wget安装kops wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum install ./epel-release-latest-*.noarch.rpm yum -y install python-pippip install --upgrade pippip install awscli安装kubectlcurl -o kubectl http

Homebrew 安装mysql

在mac上安装软件,无疑安装一个brew是个很好的选择,关于brew是什么,怎么安装建议去brew官网查看, 附上地址:brew官网  还有一篇博文 http://www.cnblogs.com/xd502djj/p/6923690.html 安装完成之后,安装其他的软件就很方便了. 先搜索下 cmd:~ dongjunjie$ brew search mysql automysqlbackup               mysql++                       mysql-

在Linux下安装aws命令行操作

使用安装包安装 环境: Linux, OS X, or Unix Python 2 version 2.6.5+ or Python 3 version 3.3+ 检查Python版本 $ python --version 安装步骤1.下载安装包 $ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"2.解压压缩包 $ unzip awscli-bundle

mac安装html5lib报错

pip安装html5lib包的时候报一下错误: ?  /test sudo  pip install html5lib The directory '/Users/lele/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that d

kubernetes安装配置

kubernetes是google公司基于docker所做的一个分布式集群,有以下主件组成 etcd: 高可用存储共享配置和服务发现,作为与minion机器上的flannel配套使用,作用是使每台 minion上运行的docker拥有不同的ip段,最终目的是使不同minion上正在运行的docker containner都有一个与别的任意一个containner(别的minion上运行的docker containner)不一样的IP地址. flannel: 网络结构支持 kube-apiser

添加IAM用户、安装AWS CLI

1. 在 Microsoft Windows 上安装 AWS Command Line Interface(下载地址: https://s3.amazonaws.com/aws-cli/AWSCLI64.msi),一路next即可 pasting 2. 添加IAM用户,并添加访问权限, https://console.aws.amazon.com/iam/home#/users ,下载Access key ID和Secret access key 3. 配置AWS 凭证 (https://doc

安装Windows7系统时,提示:缺少所需的CD/DVD驱动器设备驱动程序

      测试机型:HP probook 430 g3       系统:Windows 7 Pro x64 现在笔记本电脑主板集成的USB口大多为3.0版本,而且一些厂商为了追求PC的轻薄,不再集成光驱,所以我们在安装系统时,一般只能通过U盘或U口外接光驱. 而当我们因为需要(安装OEM系统),在通过刻录软件(如UltraISO)将系统写入U盘或光盘的方式安装系统时,此时问题就可能悄悄出现了:因为Win7官方原版系统没有集成USB3.0驱动,所以可能的报错如下: 点击"浏览"或通过