Paigo Documentation
Ask or search…
K

Configure IAM Role

Overview

This page describes how to create a IAM role and enable access for Usage Measurement and Collection. There are two alternative ways described below to create the IAM role and enable access for Paigo to query your account in order to determine usage.

Requirements

The CLI method requires you have the latest AWS CLI installed. Both ways require you have access to create and manage IAM policies within the AWS account that Paigo will interact with.

Create IAM role with AWS CLI

Prepare for the Configurations

Below are two JSON files that you need in order to enable Paigo to measurement usage. Save the below file on the file system, and name it trust-relationships.json. This JSON document defines an AWS IAM policy that allows Paigo to assume a role with access to the AWS account owned by SaaS business. Line 8 is the AWS account owned by Paigo. There is an optional field called external ID for assuming role. Change the line 12 to some other External ID for enhanced security. It is a strongly recommended practice to use External ID. However, if you want to opt out using External ID, use the JSON document of the Without External ID tab.
With External ID (Change Line 12)
Without External ID
trust-relationships.json
1
{
2
"Version": "2012-10-17",
3
"Statement": [
4
{
5
"Effect": "Allow",
6
"Action": "sts:AssumeRole",
7
"Principal": {
8
"AWS": "647662420899"
9
},
10
"Condition": {
11
"StringEquals": {
12
"sts:ExternalId": "TODO"
13
}
14
}
15
}
16
]
17
}
trust-relationships.json
1
{
2
"Version": "2012-10-17",
3
"Statement": [
4
{
5
"Effect": "Allow",
6
"Action": "sts:AssumeRole",
7
"Principal": {
8
"AWS": "647662420899"
9
}
10
}
11
]
12
}
Save the below file in the same directory as above, and name this file permissions.json. This file defines the minimal list of permission granted to Paigo for measurement, billing and analytics functionalities.
permissions.json
1
{
2
"Version": "2012-10-17",
3
"Statement": [
4
{
5
"Sid": "VisualEditor0",
6
"Effect": "Allow",
7
"Action": [
8
"eks:DescribeFargateProfile",
9
"eks:ListTagsForResource",
10
"cloudtrail:ListServiceLinkedChannels",
11
"cloudtrail:GetTrailStatus",
12
"cloudtrail:DescribeQuery",
13
"eks:ListAddons",
14
"cloudtrail:GetEventSelectors",
15
"aws-portal:ViewUsage",
16
"cloudwatch:Describe*",
17
"cloudtrail:CancelQuery",
18
"ebs:ListChangedBlocks",
19
"eks:DescribeAddon",
20
"billing:ListBillingViews",
21
"eks:DescribeNodegroup",
22
"aws-portal:ViewPaymentMethods",
23
"eks:ListUpdates",
24
"cloudtrail:GetServiceLinkedChannel",
25
"cloudtrail:ListTags",
26
"aws-portal:ViewBilling",
27
"eks:DescribeAddonVersions",
28
"cloudwatch:Get*",
29
"cloudtrail:ListQueries",
30
"cloudtrail:GetInsightSelectors",
31
"eks:ListIdentityProviderConfigs",
32
"ebs:GetSnapshotBlock",
33
"ec2:Get*",
34
"cloudtrail:LookupEvents",
35
"cloudtrail:GetTrail",
36
"eks:ListNodegroups",
37
"cloudtrail:ListTrails",
38
"cloudtrail:GetEventDataStore",
39
"aws-portal:ViewAccount",
40
"ebs:ListSnapshotBlocks",
41
"cloudwatch:List*",
42
"cloudtrail:GetQueryResults",
43
"cloudtrail:DescribeTrails",
44
"cloudtrail:ListEventDataStores",
45
"eks:ListFargateProfiles",
46
"ec2:Describe*",
47
"eks:DescribeIdentityProviderConfig",
48
"cloudtrail:ListPublicKeys",
49
"eks:DescribeUpdate",
50
"eks:AccessKubernetesApi",
51
"eks:DescribeCluster",
52
"cloudtrail:StartQuery",
53
"eks:ListClusters"
54
],
55
"Resource": "*"
56
}
57
]
58
}

Create a role with the configurations

Run the following command to grant Paigo read-only access from the directory where the configuration files prepared above are saved.
1
aws iam create-role --role-name paigo-assumed-role \
2
--assume-role-policy-document file://trust-relationships.json && \
3
aws iam put-role-policy --role-name paigo-assumed-role \
4
--policy-name read-cw-read-ec2 --policy-document file://permissions.json
In the above script, a role named paigo-assumed-role will created with the policy specified above.

Create IAM role with AWS Console

Alternatively, an IAM role can be created from AWS Console.
  1. 1.
    Navigate to the IAM Role Policy after logging in to AWS Console
  2. 2.
    On the next page for permissions choose the Create a Policy option and then chose the JSON tab. You should be presented with a page that looks like the following:
  3. 3.
    Paste the following JSON document into the JSON editor. This file defines the minimal list of permission granted to Paigo for measurement, billing and analytics functionalities.
1
{
2
"Version": "2012-10-17",
3
"Statement": [
4
{
5
"Sid": "VisualEditor0",
6
"Effect": "Allow",
7
"Action": [
8
"eks:DescribeFargateProfile",
9
"eks:ListTagsForResource",
10
"cloudtrail:ListServiceLinkedChannels",
11
"cloudtrail:GetTrailStatus",
12
"cloudtrail:DescribeQuery",
13
"eks:ListAddons",
14
"cloudtrail:GetEventSelectors",
15
"aws-portal:ViewUsage",
16
"cloudwatch:Describe*",
17
"cloudtrail:CancelQuery",
18
"ebs:ListChangedBlocks",
19
"eks:DescribeAddon",
20
"billing:ListBillingViews",
21
"eks:DescribeNodegroup",
22
"aws-portal:ViewPaymentMethods",
23
"eks:ListUpdates",
24
"cloudtrail:GetServiceLinkedChannel",
25
"cloudtrail:ListTags",
26
"aws-portal:ViewBilling",
27
"eks:DescribeAddonVersions",
28
"cloudwatch:Get*",
29
"cloudtrail:ListQueries",
30
"cloudtrail:GetInsightSelectors",
31
"eks:ListIdentityProviderConfigs",
32
"ebs:GetSnapshotBlock",
33
"ec2:Get*",
34
"cloudtrail:LookupEvents",
35
"cloudtrail:GetTrail",
36
"eks:ListNodegroups",
37
"cloudtrail:ListTrails",
38
"cloudtrail:GetEventDataStore",
39
"aws-portal:ViewAccount",
40
"ebs:ListSnapshotBlocks",
41
"cloudwatch:List*",
42
"cloudtrail:GetQueryResults",
43
"cloudtrail:DescribeTrails",
44
"cloudtrail:ListEventDataStores",
45
"eks:ListFargateProfiles",
46
"ec2:Describe*",
47
"eks:DescribeIdentityProviderConfig",
48
"cloudtrail:ListPublicKeys",
49
"eks:DescribeUpdate",
50
"eks:AccessKubernetesApi",
51
"eks:DescribeCluster",
52
"cloudtrail:StartQuery",
53
"eks:ListClusters"
54
],
55
"Resource": "*"
56
}
57
]
58
}
4. Click Next Tags , no fields are required on this page.
5. Click through to the finalize page, and enter a name you can remember, such as paigo-policy.
6. Navigate to IAM Role Page. You should see the following layout:
To configure the External ID select the Require external ID (Best practice when a third party will assume this role) near the bottom and fill in an custom string. Take note of this for entering into Paigo later.
7. Select the AWS Account option and choose the External Account choice on the next page:
8. Enter the Paigo AWS account ID: 647662420899
9. Click Next and on the following page select the paigo-policy you just created:
10. Click Next, then give it a role name you want to call it on the following page:
11. Click Create Role to save the role just created.
12. Copy the role ARN by search for the role name in the list, and click on the Copy icon below ARN. See below screenshot for an example. The role ARN and externalID will be needed by Paigo.