Skip to main content

Amazon EC2

Amazon EC2 (Elastic Cloud Compute) by Amazon Web Services (AWS) provides management for your cloud instances. You can bring instance data from Amazon EC2 into Brinqa to gain a comprehensive view of your cloud security landscape, thus strengthening your cybersecurity posture.

This document details the information you must provide for the connector to authenticate with Amazon EC2 and how to obtain that information from Amazon. See create a data integration for step-by-step instructions on setting up the integration.

Required connection settings

When setting up a data integration, select Amazon EC2 from the Connector drop-down. If you cannot find the connector in the drop-down, make sure that you have installed it first. You must provide the following information to authenticate Amazon EC2 with Brinqa:

  • Access key ID and Secret access key: The access keys associated with the Amazon EC2 account, which must have the AmazonEC2ReadOnlyAccess permission in order to access EC2 instances from the Amazon SDK. For additional information, see Create an IAM user for Amazon EC2 access.

  • Default region: The AWS region for the Amazon EC2 connector. If not specified, the connector uses the AWS Default Region Provider Chain to automatically determine the most appropriate region. This ensures that the connector adheres to the recommended AWS practices for region selection. For additional information on the AWS Default Region Provider Chain, refer to the AWS documentation.

  • Assume role: The Amazon Resource Name (ARN) for the role that the connector assumes when accessing AWS services, which must have permissions to log in to the API server and return data. You can use multiple ARNs separated by commas, e.g., target1RoleARN,target2RoleARN.

    note

    There is no character limit for the Assume role field.

Create an IAM user for Amazon EC2 access

For the Amazon EC2 connector to interact with the AWS SDK and retrieve instances, you must provide specific AWS credentials and permissions. If you want to configure cross-account access, you can skip this section and go to the Set up permissions for cross-account access section instead.

To create an IAM user for EC2 access, follow these steps:

  1. Log in to your organization's AWS Management Console as an administrator.

  2. Navigate to the Identity and Access Management (IAM) dashboard.

  3. From the navigation pane under Access management, click Users, and then click Create user.

  4. Provide a User name, leave the Provide user access to AWS Management Console option unchecked, and then click Next.

  5. Click the Attach policies directly option, search for and select the AmazonEC2ReadOnlyAccess permission.

    Amazon EC2 read only permission

  6. Click Next and then click Create user.

    The Users page displays and the new IAM user is available in the Users table.

note

If you do not have permissions to create a new IAM user, contact your AWS administrator. For additional information, see AWS documentation.

Obtain Amazon EC2 access keys

After you have created an IAM user, you can then generate the access keys that are required for the Amazon EC2 connector to access the AWS SDK. To do so, follow these steps:

  1. Navigate to the IAM dashboard.

  2. From the navigation pane under Access management, click Users.

  3. Choose the IAM user you created in the earlier steps.

  4. Click the Security credentials tab and then click Create access key.

  5. Select the Application running outside AWS use case and then click Next.

  6. Provide a description and then click Create access key.

    The access key ID and secret access key display. The secret access key is shown only once and cannot be retrieved again, so copy the key and save it to a secure location.

    Amazon EC2 access keys

note

If you do not have the permissions to create access keys, contact your Amazon EC2 administrator. For additional information, see AWS documentation.

Create a role and assign permissions

After creating an IAM user and obtaining the Amazon EC2 access keys, the next step is to create a role and obtain the ARN that is required for the integration. To do so, follow these steps:

  1. From the IAM dashboard, click Roles, and then click Create role.

  2. For the Trusted entity type, choose AWS account, and then click Next.

  3. Search for and select the AmazonEC2ReadOnlyAccess permission from the list of permissions and click Next.

  4. Assign a name and description and then click Create role.

  5. Back on the Roles page, click the new role and copy the value in the ARN field as shown below:

    Amazon EC2 ARN

    The ARN, along with the access key ID and secret access key, are required for authentication in the integration configuration.

note

If you do not have the permissions to create roles, contact your Amazon EC2 administrator. For additional information, see AWS documentation.

(Optional) Set up permissions for cross-account access

You can configure cross-account access to allow the Amazon EC2 connector to interact with multiple AWS accounts. If this is what you want to do, you can skip the Create an IAM user for Amazon EC2 access section.

Before we begin, let's introduce some terms for clarity:

  • Source account: The AWS account with EC2 instances that the connector will access.

  • Target account: The AWS account that is connected to the EC2 instances in the source account.

In every AWS target account with EC2 Instances, follow these steps:

  1. From the IAM dashboard, click Roles, and then click Create role.

  2. For the Trusted entity type, select AWS account, and then select Another AWS account.

  3. Enter the AWS account ID of the AWS source account and then click Next

  4. Attach a policy to the role that grants permissions for the actions you want to allow in the target account (e.g., AmazonEC2ReadOnlyAccess).

  5. After creating the role, select it from the list of roles and then click the Trust relationships tab.

  6. Click Edit trust policy and edit the trust relationship policy document to include the AWS source account ID you entered in step 3.

  7. Click Update policy and note down the Role ARN, as you will need this ARN in the source account for the next steps.

In the AWS source account connecting to the EC2 Instances, follow these steps:

  1. From the IAM dashboard, click Users, and then click Create user.

  2. Enter a username (e.g., CrossAccountUser) and click Next.

  3. Select Attach policies directly and then click Create policy.

  4. Click the JSON tab and attach a policy to the user that allows it to assume roles in the target account. For example, the policy should allow sts:AssumeRole for the target account's role:

    {
    "Version": "2024-05-30",
    "Statement": [
    {
    "Effect": "Allow",
    "Action": "sts:AssumeRole",
    "Resource": "<target-role-arn>"
    }
    ]
    }

    Replace <target-role-arn> with the ARN of the role created in the target account.

  5. Click Next.

  6. Repeat steps 3-5 for each target ARN.

  7. Search for and select the AmazonEC2ReadOnlyAccess permission from the list of permissions and click Next.

  8. Click Create user.

    After creating the user, follow the steps for obtaining access keys. Use these credentials in the integration configuration along with the role ARN for the target you created earlier. You can enter the ARNs in a comma-separated format: target1RoleARN, target2RoleARN, target3RoleARN.

note

For additional information on configuring cross-account access, see AWS documentation

Additional settings

The Amazon EC2 connector contains an additional option for specific configuration:

  • Session duration: The duration, in seconds, for the assumed role session. This determines the time period during which the credentials issued by the assumed role remain valid. The default setting is 900 seconds, or 15 minutes.

  • Page size: The maximum number of records to get per API request. The default setting is 100. It is not recommended to go over 100.

Types of data to retrieve

The Amazon EC2 connector can retrieve the following types of data from the Amazon EC2 API:

Table 1: Data retrieved from Amazon EC2

Connector ObjectRequiredMaps to Data Model
InstanceYesHost
info

For detailed steps on how to view the data retrieved from Amazon EC2 in the Brinqa Platform, see How to view your data.

Attribute mappings

Expand the section below to view the mappings between the source and the Brinqa data model attributes.

Instance

Table 2: Instance attribute mappings

Source Field NameMaps to Attribute
architectureAsStringLocal variable
availabilityZoneLocal variable
categoriescategories
cloudProvidercloudProvider
descriptiondescription
hypervisorAsStringLocal variable
imageIdLocal variable
instanceIduid
instanceTypeAsStringLocal variable
keyNameLocal variable
lastSeenlastSeen
launchTimefirstSeen
monitoringLocal variable
namename
networkInterfaces.macAddressmacAddresses
networkInterfaces.privateIpAddressipAddresses, privateIpAddresses, publicIpAddresses
ownerIdLocal variable
platformAsString, platformDetailsos
privateDNSNamehostnames, privateDnsName
publicDNSNamepublicDnsName
ramdiskIdLocal variable
regionregion
rootDeviceNameLocal variable
rootDeviceTypeAsStringLocal variable
securityGroupsLocal variable
statestatus, sourceStatus
stateTransitionReasonLocal variable
subnetIdLocal variable
tagstags
virtualizationTypeAsStringLocal variable
vpcIdLocal variable
info

Local variable indicates that the field is processed within a specific context, such as a particular workflow or calculation. Unlike other attributes, local variables aren't mapped to the unified data models. They only exist on the source data model.

Operation options

The Amazon EC2 connector supports the following operation options. See connector operation options for information about how to apply them.

Table 2: Amazon EC2 connector operation options

Connector ObjectOptionAll Possible ValuesDescriptionExample
InstancemaxResultsAny numeric valueLimit the number of instances returned per API call. The default value is 1000.Key: maxResults Value: 10. This key and value combination only retrieves 10 instances per API call.
regionsAny region where your Amazon EC2 instances resideRetrieve instances by the specified AWS regions.Key: regions Value: us-east-1,us-west-1. This key and value combination only retrieves instances from the us-east-1 and us-west-1 AWS regions.
note

The option keys and values are case-sensitive as they are shown in this documentation.

AWS SDK

The Amazon EC2 connector uses the AWS SDK v2.25.6. Specifically, it uses the following classes and methods:

Table 3: Amazon EC2 AWS SDK classes

AWS SDK ClassDescription
com.amazonaws.auth.AWSCredentialsProviderReturns AWS credentials.
com.amazonaws.services.ec2.AmazonEC2Interacts with the Amazon EC2 service.
com.amazonaws.services.ec2.model.AmazonEC2ExceptionHandles exceptions specific to Amazon EC2 operations.
com.amazonaws.services.ec2.model.DescribeInstancesRequestRetrieves instance details.
com.amazonaws.services.ec2.model.DescribeInstancesResultProcesses the results of instance details requests.
com.amazonaws.services.ec2.model.DescribeTagsRequestManages EC2 tags retrieval.
com.amazonaws.services.ec2.model.DescribeTagsResultProcesses the results of EC2 tags requests.
com.amazonaws.services.ec2.model.FilterApplies filtering for data retrieval.
com.amazonaws.services.ec2.model.GroupIdentifierProvides details related to instance security groups.
com.amazonaws.services.ec2.model.ReservationProvides information about reserved EC2 instances.
com.amazonaws.services.ec2.model.TagDescriptionProvides detailed information about EC2 tags.

Changelog

The Amazon EC2 connector has undergone the following changes:

3.0.11

  • Fixed an issue where the EC2 connector sync was failing due to deprecated attributes on the Instance object. As a result, the following attributes were updated:

    • HOST_NAME -> HOST_NAMES
    • PRIVATE_DNS_NAME -> PRIVATE_DNS_NAMES
    • PUBLIC_DNS_NAME -> PUBLIC_DNS_NAMES
    • PUBLIC_IP_ADDRESS -> PUBLIC_IP_ADDRESSES
  • Changed the SECURITY_GROUP attribute type on the Instance object from single to multi-valued.

3.0.10

  • No change.

3.0.9

  • No change.

3.0.8

  • No change.

3.0.7

  • No change.

3.0.6

  • No change.

3.0.5

  • Fixed an issue where the connector wasn't timing out properly.

3.0.2

  • Added API call timeouts and API call attempt timeouts.

3.0.1

  • Added the AWS icon and some missing attributes.

3.0.0