如何从命令行使用多个AWS账户? [英] How to use multiple AWS Accounts from the command line?

查看:123
本文介绍了如何从命令行使用多个AWS账户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Amazon EC2上托管了两个不同的应用程序(第二个将要启动)。

I've got two different apps that I am hosting (well the second one is about to go up) on Amazon EC2.

如何同时使用这两个应用程序在命令行上(Mac OS X)进行帐户登录,但请保留EC2键&证书分开吗?我需要在每个ec2- *命令之前更改我的环境变量吗?

How can I work with both accounts at the command line (Mac OS X) but keep the EC2 keys & certificates separate? Do I need to change my environment variables before each ec2-* command?

是否将使用别名并将其用于环境内联工作的设置?

Would using an alias and having it to the setting of the environment in-line work? Something like:

alias ec2-describe-instances1 = export EC2_PRIVATE_KEY = / path; ec2-describe-instances

alias ec2-describe-instances1 = export EC2_PRIVATE_KEY=/path ; ec2-describe-instances

推荐答案

您应该能够使用以下命令选项代替 EC2_PRIVATE_KEY (甚至 EC2_CERT )环境变量:

You should be able to use the following command-options in lieu of the EC2_PRIVATE_KEY (and even EC2_CERT) environment variables:


  • -K<私有密钥>

  • -C< certificate>

  • -K <private key>
  • -C <certificate>

您可以将其放入别名中,例如

You can put these inside aliases, e.g.

alias ec2-describe-instances1 ec2-describe-instances -K /path/to/key.pem

这篇关于如何从命令行使用多个AWS账户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆