Access Key + Role Name
5 minute read
This guide walks you through connecting your AWS account to Cloud2Gether using an Access Key combined with a Role Name. This hybrid method is useful when you have a central IAM user that needs to assume roles across multiple AWS accounts, providing both credential-based authentication and role-based access control.
When to Use This Method
This method is ideal when:
- You manage multiple AWS accounts from a central management account
- Your organization uses a hub-and-spoke IAM model where a central user assumes roles in target accounts
- You need programmatic access combined with role-based permissions
┌──────────────────────┐ AssumeRole ┌──────────────────────┐
│ Management Account │ ──────────────────► │ Target Account A │
│ │ │ Role: C2GReadOnly │
│ IAM User: │ AssumeRole ├──────────────────────┤
│ cloud2gether-user │ ──────────────────► │ Target Account B │
│ (Access Key) │ │ Role: C2GReadOnly │
└──────────────────────┘ └──────────────────────┘
Part 1: Create the IAM Role in the Target AWS Account
First, create an IAM role in the AWS account you want Cloud2Gether to analyze.
Step 1: Open the IAM Console
- Sign in to the AWS Management Console for the target account
- Navigate to IAM → Roles
- Click Create role
Step 2: Select Trusted Entity
- Select AWS account as the trusted entity type
- Select Another AWS account
- Enter the Account ID of the AWS account where your IAM user resides (the management account)
Step 3: Attach Permissions
- Search for
ReadOnlyAccess - Check the box next to the ReadOnlyAccess managed policy
- Click Next
Step 4: Name and Create the Role
- Enter a role name, for example:
Cloud2GetherReadOnlyRole - Click Create role
- Click on the newly created role and copy the Role ARN
Part 2: Create the IAM User in the Management Account
Now, create an IAM user that has permission to assume the role you just created.
Step 1: Create a New IAM User
- Sign in to the AWS Management Console for the management account
- Navigate to IAM → Users → Create user
- Enter a user name, for example:
cloud2gether-assume-role - Click Next
Step 2: Create an AssumeRole Policy
Instead of attaching ReadOnlyAccess directly, this user only needs permission to assume the target role.
- Select Attach policies directly
- Click Create policy (opens a new tab)
- Switch to the JSON tab and paste the following policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": [
"arn:aws:iam::<TARGET_ACCOUNT_ID>:role/Cloud2GetherReadOnlyRole"
]
}
]
}
Replace <TARGET_ACCOUNT_ID> with the AWS Account ID of the target account where the role was created.
To assume roles in multiple target accounts, add each role ARN to the Resource array:
"Resource": [
"arn:aws:iam::111111111111:role/Cloud2GetherReadOnlyRole",
"arn:aws:iam::222222222222:role/Cloud2GetherReadOnlyRole"
]
- Click Next
- Name the policy, for example:
Cloud2GetherAssumeRolePolicy - Click Create policy
Step 3: Attach the Policy to the User
- Go back to the user creation tab
- Click the refresh button next to the policy list
- Search for
Cloud2GetherAssumeRolePolicy - Check the box next to it
- Click Next → Create user
Step 4: Generate Access Keys
- Click on the newly created user
- Go to the Security credentials tab
- Click Create access key
- Select Third-party service as the use case
- Click Next → Create access key
- Copy the Access Key ID and Secret Access Key
This is the only time you can view or copy the Secret Access Key. Store these credentials securely.
Part 3: Update the Role Trust Policy
Ensure the role in the target account trusts the IAM user you created.
- In the target account, go to IAM → Roles
- Click on Cloud2GetherReadOnlyRole
- Go to the Trust relationships tab
- Click Edit trust policy
- Verify the trust policy allows the management account:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<MANAGEMENT_ACCOUNT_ID>:root"
},
"Action": "sts:AssumeRole"
}
]
}
Replace <MANAGEMENT_ACCOUNT_ID> with the Account ID where the IAM user resides.
For tighter security, you can restrict the trust to the specific IAM user instead of the entire account:
"Principal": {
"AWS": "arn:aws:iam::<MANAGEMENT_ACCOUNT_ID>:user/cloud2gether-assume-role"
}
Part 4: Connect in Cloud2Gether
Step 1: Navigate to Cloud Accounts
- Log in to Cloud2Gether
- In the left sidebar, click Cloud Accounts
- Click the Add Account button
- Select AWS as the cloud provider
Step 2: Enter Account Details
- Account name: Enter a descriptive name for this account (e.g.,
AWS Production - Assumed Role) - Select the Access Key + Role Name connection method
Step 3: Enter Your Credentials
- Paste your Access Key ID
- Paste your Secret Access Key
- Enter the Role Name or Role ARN of the role in the target account (e.g.,
Cloud2GetherReadOnlyRoleor the full ARN)
Step 4: Add the Account
- Click Add Account
- Cloud2Gether will use the access keys to assume the specified role and begin discovering resources
Your AWS account is now connected using Access Key + Role Name. Cloud2Gether will assume the specified role to scan your resources, and they will appear in your dashboard within a few minutes.
Troubleshooting
| Issue | Solution |
|---|---|
| Access denied when assuming role | Verify the IAM user has the sts:AssumeRole permission and the role’s trust policy allows the user/account. |
| Invalid credentials | Ensure the Access Key ID and Secret Access Key are correct. |
| Role not found | Verify the role name/ARN is correct and the role exists in the target account. |
| Resources not appearing | Allow a few minutes for the initial resource discovery to complete. |
Next Steps
- Explore your resources in the Resource Catalog
- Set up additional cloud accounts for a multi-cloud view
Feedback
Was this page helpful?
Was this page helpful?
Let us know how we can improve