Prerequisites for configuring Amazon EC2 instance

This section describes the prerequisites that you must perform before you configure an AWS instance. The following topics are provided:


Creating a user with read-only access

If you want to monitor an AWS, create a user with read-only access.

  1. Log on to the Amazon Web Services console with valid user credentials.
  2. Select Policies > Create policy.
  3. Click the JSON tab and enter the following JSON example:

    JSON example
    {
    "Version": "yyyy-mm-dd",
    "Statement": [      
    {
    "Sid": "Statement Id",
    "Effect": "Allow",
    "Action": [  
               "Service1:Permission1",
               "Service2:Permission2"
              ],
    "Resource": [
                  "*"          
                ]      
           }
        ]
    }
    
    {
    "Version":"2012-10-17",
    "Statement":[     
         {    
    		"Sid": "Stmt1433933070000",
    		"Effect": "Allow",
    		"Action": [ 
    					"apigateway:GET",
    					"autoscaling:DescribeAutoScalingGroups",
    					"cloudfront:ListDistributions",
    					"cloudfront:ListStreamingDistributions",
    					"cloudwatch:GetMetricStatistics",
    					"cloudwatch:ListMetrics",
    					"dynamodb:DescribeTable",
    					"dynamodb:ListTables",            
                        "ec2:DescribeInstances",             
                        "ec2:DescribeVolumes",             
                        "elasticache:DescribeCacheClusters",
    					"elasticloadbalancing:DescribeLoadBalancers",
    					"elasticmapreduce:ListClusters",                  
                        "iam:GetUser",
                        "iot:ListTopicRules",
    					"iot:GetTopicRule",                  
                        "lambda:ListFunctions",
    					"logs:DescribeLogStreams",
    					"logs:FilterLogEvents",
    					"opsworks:DescribeInstances",
    					"opsworks:DescribeLayers",
    					"opsworks:DescribeStacks",                  
    					"rds:DescribeDBInstances",             
    					"redshift:DescribeClusters",
    					"route53:ListHealthChecks",  
    					"s3:ListBucket", 
                    	"s3:ListAllMyBuckets",
                   		"s3:GetBucketLocation",
    					"sns:ListTopics", 
    					"sqs:ListQueues",
    					"storagegateway:ListGateways"                  
                      ],
    			"Resource":[           
                            "*"        
                           ]    
          }             
       ]
    }


    JSON that you enter is validated and errors are displayed, if any.

  4. Click Next: Tags.
    For more information, see  Creating a new policy Open link
  5. (Optional) Add tags (key–value pairs) that you can add to AWS resources to help identify, organize, or search for resources.
  6. Click Next: Review.
  7. Enter a name for the policy.
    For example, aws-monitor-policy.
  8. Review the policy details and click Create Policy.
  9. To create a user to use for monitoring, perform the following actions:
    1. Go to Users > Add Users.
    2. In the User name field, enter the user name for the new IAM account.
      For example, aws-monitor-user.
    3. Under Select AWS access type, select Programmatic access.
    4. Click Next: Permissions.
    5. Select Attach existing policies directly.
    6. In the Filter box, search for the policy that you created in the previous step (aws-monitor-policy) and select it.
    7. Click Next: Tags and then click Next: Review.
    8. Click Create User.
      The policy (aws-monitor-policy) is associated with the newly created IAM user (aws-monitor-user).
    9. Note down the access key ID and the secret access key.

      Tip

      Click Download .csv to download the access key ID and the secret key of the newly added user.

Monitoring multiple AWS accounts

You can configure monitoring of multiple AWS accounts by using one account as main account or trusted account. The main account is responsible for retrieving data from other accounts or trusting accounts.

Configure the main or trusted account as per the steps mentioned in the Monitoring single AWS account topic.

Perform these steps in all additional or trusting accounts from which you want the main, trusted account to retrieve data.


StepDetails
1

Obtain the account ID and note it down.

You will need to enter this account ID when configuring a policy in the main, trusted AWS account to include the additional account details. You will also need to enter it while configuring the monitoring policy.

In the AWS Management Console header, click the account name and select My Account.

The Account Settings information displays the Account ID.

2Configure a policy (aws-trusted-policy) to specify permissions for the user of the additional, trusted AWS account.
  1. Select Policies > Create policy.
  2. Click the JSON tab and enter the following JSON example:

    {
    "Version":"2012-10-17",
    "Statement":[     
         {    
    		"Sid": "Stmt1433933070000",
    		"Effect": "Allow",
    		"Action": [ 
    					"apigateway:GET",
    					"autoscaling:DescribeAutoScalingGroups",
    					"cloudfront:ListDistributions",
    					"cloudfront:ListStreamingDistributions",
    					"cloudwatch:GetMetricStatistics",
    					"cloudwatch:ListMetrics",
    					"dynamodb:DescribeTable",
    					"dynamodb:ListTables",            
                        "ec2:DescribeInstances",             
                        "ec2:DescribeVolumes",             
                        "elasticache:DescribeCacheClusters",
    					"elasticloadbalancing:DescribeLoadBalancers",
    					"elasticmapreduce:ListClusters",                  
                        "iam:GetUser",
                        "iot:ListTopicRules",
    					"iot:GetTopicRule",                  
                        "lambda:ListFunctions",
    					"logs:DescribeLogStreams",
    					"logs:FilterLogEvents",
    					"opsworks:DescribeInstances",
    					"opsworks:DescribeLayers",
    					"opsworks:DescribeStacks",                  
    					"rds:DescribeDBInstances",             
    					"redshift:DescribeClusters",
    					"route53:ListHealthChecks",  
    					"s3:ListBucket", 
                    	"s3:ListAllMyBuckets",
                   		"s3:GetBucketLocation",
    					"sns:ListTopics", 
    					"sqs:ListQueues",
    					"storagegateway:ListGateways"                  
                      ],
    			"Resource":[           
                            "*"        
                           ]    
          }             
       ]
    }

    JSON that you enter is validated and errors are displayed, if any.

  3. Click Next: Tags.
    For more information, see  Creating a new policy Open link
  4. (Optional) Add tags (key–value pairs) that you can add to AWS resources to help identify, organize, or search for resources.
  5. Click Next: Review.
  6. Enter a name for the policy.
    For example, aws-monitor-trusting-policy.
  7. Review the policy details and click Create Policy.
3

Create a cross-account access role (aws-cross-account-role).

This step enables the main, trusted AWS account user (aws-monitor-user) to have federated read-only access to the AWS services in the additional, trusting account and to enable account switching.

  1. Click Roles > Create role.
  2. Select Another AWS account.
  3. Enter the account ID of the main AWS account.
  4. Click Next: Permissions.
  5. Search for the policy that you created (aws-monitor-trusting-policy), select it, and click Next: Tags.
  6. Click Next: Review.
  7. Enter the role name as aws-cross-account-role and click Create role
    The role is created.
  8. Click the role.
  9. On the Trust relationships tab, click Edit trust relationship.
  10. Replace the "root" element with the IAM user name that you created in the main account (aws-monitor-user).
  11. Click Update Trust Policy to save the changes.
4
In the main AWS account, configure a policy file (aws-assume-role-policy.json) to include the additional account details.

If you are configuring the first additional AWS account, you need to create a policy file. Else, you need to update the existing file with the additional AWS account details.

Information

A single policy file can include details of all the additional AWS accounts.

To create a policy file

  1. Open a new file in any text editor, such as Notepad.
  2. Copy the following content in the file and replace ADDITIONAL_ACCOUNT_ID with the account ID of the additional account that you obtained in step 1.

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Sid": "Stmt1500499562000",
                "Effect": "Allow",
                "Action": [
                    "sts:AssumeRole"
                ],
                "Resource": [
                    "arn:aws:iam::ADDITIONAL_ACCOUNT_ID:role/aws-cross-account-role"
                ]
            }
        ]
    }
  3. Save the file as aws-assume-role-policy.json.

To update an existing policy file

  1. In the JSON file that you created (aws-assume-role-policy.json), add the next additional account information on a new line, separated by a comma.

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Sid": "Stmt1500499562000",
                "Effect": "Allow",
                "Action": [
                    "sts:AssumeRole"
                ],
                "Resource": [
                    "arn:aws:iam::ADDITIONAL_ACCOUNT_ID1:role/aws-cross-account-role",
                    "arn:aws:iam::ADDITIONAL_ACCOUNT_ID2:role/aws-cross-account-role"
                ]
            }
        ]
    }
  2. Save the file.

5Enable the policy (aws-assume-role-policy.json) that includes additional AWS account details in the main AWS account.
  1. Select the IAM service and select Users.
  2. Select the IAM user (aws-monitor-user) that you created in the Creating a user with read-only access section.
  3. On the Summary page, select the Permissions tab and click Add inline policy.
  4. Click the JSON tab and enter the contents of the policy file (aws-assume-role-policy.json).
  5. On the Review Policy page, enter a name for the policy (aws-assume-role).
  6. Click Create Policy.
Was this page helpful? Yes No Submitting... Thank you

Comments