Configuring Cost for AWS
Prerequisitesβ
Ensure your IAM user that has full access to billing data (including adding cost allocation tags). For details, see this official AWS help page: IAM tutorial: Delegate access to the billing console.
Configure cost allocation tags in your AWS account. See the next section AWS Cost setup.
Create a role to be used by Torque to gather the cost information and obtain the following information :
- External Id
- Role ARN
AWS Cost setup:β
To configure Torqueβs Cost Allocation Tags:
- Launch a sandbox via Torque OR add tags called torque-account-id and torque-environment-id to any resource in your AWS account.
- Login to your AWS management console and in the top toolbar, select Services.
- Search for Billing and select it from the result list.
- Select Cost Allocation Tags.
- Search for the following tags: torque-account-id, torque-environment-id.
- Select the box to the left of each tag and select Activate.
Get Role ARN and external ID:β
In your AWS Management Console, open the IAM console at https://console.aws.amazon.com/iam/.
In the navigation pane of the IAM console, select Policies, and then click Create Policy.
- Select the Cost Explorer Service
- Select the GetCostAndUsage Action
- Choose a name for your policy and save it.
In the navigation pane of the IAM console, select Roles, and then click Create Role.
- From Select trusted entity, choose AWS Account.
- Under An AWS account ID, select An AWS account and enter 349148204654. (This is the Torque AWS account # where we will query the cost from).
- Select Require external ID.
- Enter an External ID of your choosing. The External Id will be used to validate the Consumer of the ARN Role. Keep note of the external ID as you will need it later in the configuration step.
- In Next:Permissions, select the policy you have just created in step 1 for cost exploration permission.
- Click Next.
- Enter a Role Name or role name suffix to help you identify the purpose of this role or use AWS defined Name.
- Click Create Role.
- (Optional) Enter a Description for the new role.
- Review the role and then click Create role. Keep note of the role ARN as you will need it later in the configuration step.
Configurationβ
Create an AWS cost collection target:
- Go to Administration > Cloud Accounts > Cost Collection Target.
- Click Add Cost Collection Target.
- Select AWS.
- Specify the cloud account's details (see Prerequisites):
- External Id
- Role ARN
- Click Finish.
- Click the cost collection target's 3 dot menu and select Validate to make sure it works (i.e. cost data can be collected).
- If validation fails, it means there is a problem with the Role or external ID. Review them and correct as necessary.
Enable the cost collection target for your AWS account:
Go to Administration > Cloud Accounts > Cost Collection Target.
Click the desired cost collection target's Enabled toggle.
Troubleshootingβ
What can be done if you don't see cost in Torque's cost dashboard?
- Cost collection happens only once a day and takes time. Make sure at least 48 hours passed since you configured cost and you have environments running during that time frame.
- Choose one of the environments that should have cost associated with them in your AWS cloud, and do the following:
- Obtain the environment id - it appears in the URL of the environment page:
- In your AWS console, navigate to the billing service (e.g. https://us-east-1.console.aws.amazon.com/billing/home?region=us-east-1#/) and on the left panel select Cost Expolorer > Daily Spend View.
- On the Filters panel on the right, select Tag and search for torque-environment-id.
- Click on the > sign and select the environment id that you found via the Torque URL.
- If the environment id doesn't have cost associated with it, it means that the cost allocation tags are not configured correctly. Review AWS Cost setup again.
- If you see costs associated with this tag, test your credentials: navigate to Administration > Cloud Accounts > Cost Collection Target > Choose your cloud > In the three dot menu click on validate.
- Obtain the environment id - it appears in the URL of the environment page: