Topics on this page
Add an AWS account using a cross-account role
You can add an AWS account using a cross-account role. Use a cross-account role if you want to add multiple AWS accounts, or if you want to add a single account but do not want to use the quick setup method.
The following instructions assume you want to add an AWS account with the name AWS Account A.
You can also add a cross-account role through the Workload Security API. See Add the account through the API for details.
First, note the Workload Security account ID
Workload Security Account ID: 147995105371
You will need this ID later, when creating the cross-account role.
Next, configure the manager instance role
- In the Workload Security console, click Administration at the top.
- Click System Settings on the left.
- Click the Advanced tab in the main pane.
- Scroll to the bottom and look for the Manager AWS Identity section.
- Make sure Use Manager Instance Role is selected.
- Click Save.
Next, retrieve the external ID
- Log in to Workload Security.
- Click Computers at the top.
- Click Add > Add AWS Account. A wizard appears.
- Click Advanced, then click Next.
- Click the eye icon next to the obscured external ID to reveal it. For more on this ID, see What is the external ID?
- Copy the external ID to a secure place. You will need it in the next step to configure AWS Account A and any other AWS accounts you want to add.
- Optionally, close the wizard and the Workload Security console.
Next, configure an IAM policy for AWS Account A
- Make sure you're logged in to AWS Account A.
- In the Amazon Web Services Console, go to the IAM service.
- In the left navigation pane, click Policies.
If this is your first time on this page, you'll need to click Get Started.
- Click Create policy.
- Select the JSON tab.
- Copy the following JSON code into the text box:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "cloudconnector", "Action": [ "ec2:DescribeImages", "ec2:DescribeInstances", "ec2:DescribeRegions", "ec2:DescribeSubnets", "ec2:DescribeTags", "ec2:DescribeVpcs", "ec2:DescribeAvailabilityZones", "ec2:DescribeSecurityGroups", "workspaces:DescribeWorkspaces", "workspaces:DescribeWorkspaceDirectories", "workspaces:DescribeWorkspaceBundles", "workspaces:DescribeTags", "iam:ListAccountAliases", "iam:GetRole", "iam:GetRolePolicy" ], "Effect": "Allow", "Resource": "*" } ] }
The "iam:GetRole" and "iam:GetRolePolicy" permissions are optional, but recommended because they allow Workload Security to determine whether you have the correct policy when an update to Workload Security occurs that requires additional AWS permissions.
- Click Review policy.
- Give the policy a name and description. Example name:
Workload_Security_Policy_Cross
. - Click Create policy. Your policy is now ready to use.
Next, create a cross-account role for AWS Account A
- Make sure you are logged in to AWS Account A.
- Go to the IAM service.
- In the left navigation pane, click Roles.
- In the main pane, click Create role.
- Click Another AWS account.
- In the Account ID field, enter the Workload Security account ID. It is:
147995105371
- Next to Options, enable Require external ID. In the External ID field, enter the external ID you retrieved from the Workload Security console earlier.
- Click Next: Permissions.
- Select the IAM policy that you just created (the example name was
Workload_Security_Policy_Cross
) and then click Next: Review. - On the Review page, enter a role name and description. Example role name:
Workload_Security_Role_Cross
. - On the main role page, search for the role you just created (
Workload_Security_Role_Cross
). - Click it.
- Find the Role ARN field at the top. It looks similar to:
arn:aws:iam::2222222222:role/Workload_Security_Role_Cross
- Note the Role ARN value. You will need it later.
You now have a cross-account role under AWS Account A that includes the correct policy and references the of the AWS Primary Account.
Next, add AWS Account A to Workload Security
- Log in to Workload Security.
- Click Computers at the top.
- Click Add > Add AWS Account.
- Select Advanced and click Next.
- Select Use Cross Account Role.
- Enter AWS Account A's Cross Account Role ARN. You noted this earlier, when you created the cross-account role. In this example, it is
arn:aws:iam::2222222222:role/Workload_Security_Role_Cross
- If AWS Account A includes Amazon WorkSpaces, select Include Amazon WorkSpaces to include them with your Amazon EC2 instances. By enabling the check box, you ensure that your Amazon WorkSpaces appear in the correct location in the tree structure in the Workload Security console and are billed at the correct rate.
- Click Next.
AWS Account A's Amazon EC2 instances and Amazon WorkSpaces are loaded.
You have now added AWS Account A to Workload Security.
After completing the preceding steps, proceed to Install the agent on your Amazon EC2 and WorkSpace instances if you have not done so already.
Add the account through the API
- If you do not yet have the external ID, call the Workload Security
/api/awsconnectorsettings
endpoint to retrieve it (theExternalId
parameter). For more on this ID, see What is the external ID? - In AWS, specify the external ID in your cross-account role's IAM trust policy.
- Use the
/api/awsconnectors
API endpoint to add AWS accounts to Workload Security. Do not use the/rest/cloudaccounts/aws
API because it has been deprecated. See Action required if you are using cross account roles with the API /rest/cloudaccounts/aws for details on how long the/rest/cloudaccounts/aws
API will continue to be supported and tips on how to move to the new endpoint.