in Education by
I've got two different apps that I am hosting (well the second one is about to go up) on Amazon 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 Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
You can use these following command-options using EC2_PRIVATE_KEY (and even EC2_CERT) environment variables: -K -C After that, you can use them inside aliases, e.g. alias ec2-describe-instances1 ec2-describe-instances -K /path/to/yourkey.pem There is also a straightforward way to do this: $ aws configure --profile myaccount1 $ aws configure --profile myaccount2 You can then switch between the accounts by passing the profile on the command. $ aws dynamodb list-tables --profile myaccount1 $ aws s3 ls --profile myaccount2 Also, you can set your primary account by mentioning default in it

Related questions

0 votes
    I am trying to use aws container service as per the documentation in http://docs.aws.amazon.com/AmazonECS/latest/ ... in a console? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    Amazon recently added the wonderful feature of tagging EC2 instances with key-value pairs to make the management of ... the tags? Select the correct answer from above options...
asked Feb 3, 2022 in Education by JackTerrance
0 votes
    I want to list the public IP addresses of my EC2 instances using Bash, separated by a delimiter (space or ... something else entirely? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I am using the aws cli to list the files in an s3 bucket using the following command (documentation): aws s3 ... only the file list? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I tried to follow this tutorial. This is what I did in the console: pip3 install --user --upgrade awscli after ... 's the problem here? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I'm having trouble using * in the AWS CLI to select a subset of files from a certain bucket. Adding * to the ... s3://data/2016-08*. Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I'm starting a bash script which will take a path in S3 (as specified to the ls command) and dump the ... finding which does it? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    Looking for a quick way to pull my account number, I had originally thought of using aws iam get-account- ... cross-account origins? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I installed Ubuntu 12.04 on my instance and am trying to install packages using apt-get, but I am getting the ... do I fix this? Select the correct answer from above options...
asked Feb 4, 2022 in Education by JackTerrance
0 votes
    I am trying out a simple example suggested by AWS documentation to create a role using a policy json file http:// ... botocore/1.3.9 Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I created a new Access Key and configured that in the AWS CLI with aws configure. It created the .ini file in ~/ ... . How to fix this? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I'm trying to set up an Amazon Linux AMI(ami-f0091d91) and have a script that runs a copy command to copy ... what is going on? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    Is it possible to get the ARN of an S3 bucket via the AWS command line? I have looked through the documentation ... way to do this. Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    Every time I want to config something with AWS I get the following error : "The config profile (myname) ... encrypt my credentials. Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I am going to create a new distribution at CloudFront. Already I have uploaded my SSL certificate at AWS IAM ... for this distribution? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
...