Skip to main content

Configuring Cost for AWS

Prerequisites​

  1. 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.

  2. Configure cost allocation tags in your AWS account. See the next section AWS Cost setup.

  3. Create a role to be used by Torque to gather the cost information and obtain the following information :

    • External Id
    • Role ARN

    See Get Role ARN and external ID.

AWS Cost setup:​

To configure Torque’s Cost Allocation Tags:

  1. Launch a sandbox via Torque OR add tags called torque-account-id and torque-environment-id to any resource in your AWS account.
  2. Login to your AWS management console and in the top toolbar, select Services.
  3. Search for Billing and select it from the result list.
  4. Select Cost Allocation Tags.
  5. Search for the following tags: torque-account-id, torque-environment-id.
  6. Select the box to the left of each tag and select Activate.

Get Role ARN and external ID:​

  1. In your AWS Management Console, open the IAM console at https://console.aws.amazon.com/iam/.

  2. In the navigation pane of the IAM console, select Policies, and then click Create Policy.

    1. Select the Cost Explorer Service
    2. Select the GetCostAndUsage Action
    3. Choose a name for your policy and save it.
  3. In the navigation pane of the IAM console, select Roles, and then click Create Role.

    1. From Select trusted entity, choose AWS Account.
    2. 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).
    3. Select Require external ID.
    4. 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.
    5. In Next:Permissions, select the policy you have just created in step 1 for cost exploration permission.
    6. Click Next.
    7. Enter a Role Name or role name suffix to help you identify the purpose of this role or use AWS defined Name.
    8. Click Create Role.
    9. (Optional) Enter a Description for the new role.
    10. 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​

  1. Create an AWS cost collection target:

    1. Go to Administration > Cloud Accounts > Cost Collection Target.
    2. Click Add Cost Collection Target.
    3. Select AWS.
    4. Specify the cloud account's details (see Prerequisites):
      • External Id
      • Role ARN
    5. Click Finish.
    6. 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.
  2. Enable the cost collection target for your AWS account:

    1. Go to Administration > Cloud Accounts > Cost Collection Target.

    2. Click the desired cost collection target's Enabled toggle.

      Locale Dropdown

Troubleshooting​

What can be done if you don't see cost in Torque's cost dashboard?

  1. 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.
  2. Choose one of the environments that should have cost associated with them in your AWS cloud, and do the following:
    1. Obtain the environment id - it appears in the URL of the environment page:

      Locale Dropdown

    2. 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.
    3. On the Filters panel on the right, select Tag and search for torque-environment-id.
    4. Click on the > sign and select the environment id that you found via the Torque URL.
    5. 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.
    6. 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.