Role Delegation
5 minute read
This guide walks you through connecting your AWS account to Cloud2Gether using IAM Role Delegation. This is the recommended method for production environments because it uses temporary credentials and does not require storing long-lived access keys.
Role Delegation follows AWS security best practices. Cloud2Gether assumes a role in your account using temporary credentials that are automatically rotated, eliminating the risk of leaked long-lived keys.
How It Works
With Role Delegation, you create an IAM role in your AWS account that trusts Cloud2Gether’s AWS account. When Cloud2Gether needs to access your resources, it assumes this role using the AWS Security Token Service (STS), receiving temporary credentials that expire automatically.
┌─────────────────────┐ STS AssumeRole ┌─────────────────────┐
│ Cloud2Gether │ ──────────────────────────────► │ Your AWS Account │
│ AWS Account │ │ │
│ │ ◄────────────────────────────── │ IAM Role with │
│ │ Temporary Credentials │ ReadOnlyAccess │
└─────────────────────┘ └─────────────────────┘
Part 1: Create an IAM Role in AWS
You can set up the IAM role either automatically using CloudFormation or manually through the IAM console.
Automatic Setup via CloudFormation
The easiest way to create the required IAM role is using Cloud2Gether’s CloudFormation template, which automatically provisions everything you need.
Step 1: Start in Cloud2Gether
- Log in to Cloud2Gether
- Navigate to Cloud Accounts → Add Account → AWS
- Enter an account name
- Select the AWS region where the CloudFormation stack will be created
- Choose Automatically using CloudFormation
Step 2: Launch the CloudFormation Stack
- Click the Launch button — you will be redirected to the AWS Console
- The CloudFormation template will be pre-loaded with the required parameters
- Review the template details
- Check the acknowledgement box at the bottom (for IAM resource creation)
- Click Create Stack
Step 3: Wait for Stack Creation
- Wait for the stack status to change to CREATE_COMPLETE (usually takes 1-2 minutes)
- Go to the Outputs tab to find the Role ARN
Step 4: Complete in Cloud2Gether
- Back in Cloud2Gether, check the confirmation box: “I confirm that the Cloud2Gether IAM Role has been added to the AWS Account”
- Enter your AWS Account ID
- Enter the Role ARN from the CloudFormation Outputs tab
- Click Add Account
Manual Setup via IAM Console
If you prefer full control or your organization restricts CloudFormation usage, you can create the IAM role manually.
Step 1: Open the IAM Console
- Sign in to the AWS Management Console
- 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 Cloud2Gether’s Account ID:
<CLOUD2GETHER_ACCOUNT_ID> - (Optional) Check Require external ID and enter the External ID shown in the Cloud2Gether platform
The External ID provides an additional layer of security against the confused deputy problem. You can find the External ID in the Cloud2Gether platform when adding a new AWS account.
Step 3: Attach Permissions
- In the search box, type
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 - Optionally add a description:
Read-only access role for Cloud2Gether platform - Review the trusted entities and permissions
- Click Create role
Step 5: Copy the Role ARN
- Click on the newly created role name to open its details
- Copy the Role ARN (it looks like
arn:aws:iam::123456789012:role/Cloud2GetherReadOnlyRole)
Part 2: 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) - Select the AWS region
- Choose Role Delegation as the connection method
Step 3: Enter Role Delegation Info
- Check the confirmation box: “I confirm that the Cloud2Gether IAM Role has been added to the AWS Account”
- Enter your AWS Account ID (12-digit number found in the top-right corner of the AWS Console)
- Enter the AWS Role ARN you copied earlier
Your AWS Account ID is a 12-digit number. You can find it by clicking your account name in the top-right corner of the AWS Management Console, or by running aws sts get-caller-identity in the AWS CLI.
Step 4: Add the Account
- Click Add Account
- Cloud2Gether will validate the role assumption and begin discovering your AWS resources
Your AWS account is now connected via Role Delegation. Cloud2Gether will start scanning your resources and they will appear in your dashboard within a few minutes.
Trust Policy Reference
For reference, this is the trust policy that should be attached to your IAM role. If you used CloudFormation, this was configured automatically.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<CLOUD2GETHER_ACCOUNT_ID>:root"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:ExternalId": "<YOUR_EXTERNAL_ID>"
}
}
}
]
}
Replace <CLOUD2GETHER_ACCOUNT_ID> with Cloud2Gether’s AWS Account ID and <YOUR_EXTERNAL_ID> with the External ID provided in the Cloud2Gether platform.
Troubleshooting
| Issue | Solution |
|---|---|
| Access denied when assuming role | Verify the trust policy contains the correct Cloud2Gether Account ID and External ID. |
| Role not found | Ensure the Role ARN is correct and the role exists in the specified account. |
| CloudFormation stack failed | Check the Events tab in CloudFormation for error details. Common issues include insufficient permissions to create IAM roles. |
| 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