Souad
Souad

Reputation: 5094

clone CodeCommit repo in another AWS Account

I have a CodeCommit repo in Account A.

I have an EC2 instance in Account B (I installed terraform on it)

To connect to all accounts, I assume a role by my IAM user in an Account C.

I attached a role to my instance that allows it to assume any role. Inside the EC2, I installed AWS Cli with my IAM User credentials on Account C.

this is my file .aws/config:

[default]
output = json
region = eu-west-1

[dev]
region = eu-west-1
role_arn = arn:aws:iam::xxxxxxxxxx:role/use-codecommit
source_profile = default
output = json

The role arn:aws:iam::xxxxxxxxxx:role/use-codecommit is in Account A.

So when I try to clone a repo in the Account A I get this error:

The config profile (dev) could not be found

How to make this work?

Upvotes: 0

Views: 990

Answers (1)

jarmod
jarmod

Reputation: 78663

The way you indicate profiles in ~/.aws/config is different to ~/.aws/credentials.

Use [profile dev] ~/.aws/config and [dev] in ~/.aws/credentials.

Upvotes: 1

Related Questions