Collect AWS EC2 Hosts logs
This document explains how to integrate AWS EC2 Hosts logs into Google Security Operations for monitoring and analysis. The integration involves parsing and mapping EC2 host logs to the Unified Data Model (UDM), performing data transformation, and creating relationships between EC2 hosts and instances. The logs provide valuable information about the instances, host properties, instance types, and performance metrics that can be used for security monitoring, audit, and compliance.
Before you begin
- Ensure that you have a Google SecOps instance.
- Ensure that you have privileged access to AWS.
Configure AWS IAM and S3
- Create an Amazon S3 bucket following this user guide: Creating a bucket.
- Save the bucket Name and Region for later use.
- Create a user following this user guide: Creating an IAM user.
- Select the created User.
- Select the Security credentials tab.
- Click Create Access Key in the Access Keys section.
- Select Third-party service as the Use case.
- Click Next.
- Optional: add a description tag.
- Click Create access key.
- Click Download CSV file to save the Access Key and Secret Access Key for later use.
- Click Done.
- Select the Permissions tab.
- Click Add permissions in the Permissions policies section.
- Select Add permissions.
- Select Attach policies directly
- Search for and select the AmazonS3FullAccess policy.
- Click Next.
- Click Add permissions.
Configure CloudTrail for AWS KMS
- Sign in to the AWS Management Console.
- In the search bar, type and select CloudTrail from the services list.
- Click Create trail.
- Provide a Trail name; for example, EC2-Activity-Trail.
- Select the Enable for all accounts in my organization checkbox.
- Type the S3 bucket URI created earlier (the format should be: s3://your-log-bucket-name/), or create a new S3 bucket.
- If SSE-KMS is enabled, provide a name for AWS KMS alias, or choose an existing AWS KMS Key.
- You can leave the other settings as default.
- Click Next.
- Select Management events and Data events under Event Types to capture EC2 host activity.
- Click Next.
- Review the settings in Review and create.
- Click Create trail.
- Optional: if you created a new bucket, continue with the following process:
- Go to S3.
- Identify and select the newly created log bucket.
- Select the folder AWSLogs.
- Click Copy S3 URI and save it.
 
Configure a feed in Google SecOps to ingest AWS EC2 Hosts
- Go to SIEM Settings > Feeds.
- Click Add new.
- In the Feed name field, enter a name for the feed; for example, AWS EC2 Hosts Logs.
- Select Amazon S3 V2 as the Source type.
- Select AWS EC2 Hosts as the Log type.
- Click Next.
- Specify values for the following input parameters: - S3 URI: the bucket URI.
- s3://your-log-bucket-name/- Replace your-log-bucket-namewith the actual name of the bucket.
 
- Replace 
 
- Source deletion options: select the deletion option according to your preference. 
- Maximum File Age: Include files modified in the last number of days. Default is 180 days. 
- Access Key ID: the User access key with access to the s3 bucket. 
- Secret Access Key: the User secret key with access to the s3 bucket. 
- Asset namespace: the asset namespace. 
- Ingestion labels: the label to be applied to the events from this feed. 
 
- S3 URI: the bucket URI.
- Click Next. 
- Review your new feed configuration in the Finalize screen, and then click Submit. 
UDM Mapping Table
| Log Field | UDM Mapping | Logic | 
|---|---|---|
| AllocationTime | entity.metadata.creation_timestamp | The AllocationTimefield is parsed as a timestamp and mapped to thecreation_timestampfield.  The parser attempts various formats (yyyy-MM-dd HH:mm:ss, RFC 3339, UNIX, ISO8601). | 
| AllowsMultipleInstanceTypes | entity.entity.asset.attribute.labels.value | The value of AllowsMultipleInstanceTypesfrom the raw log is used as the value of a label. The key for this label is set toallows_multiple_instance_types. | 
| AutoPlacement | entity.entity.asset.attribute.labels.value | The value of AutoPlacementfrom the raw log is used as the value of a label. The key for this label is set toauto_placement. | 
| AvailabilityZone | entity.entity.asset.attribute.cloud.availability_zone | The AvailabilityZonefield is directly mapped to theavailability_zonefield. | 
| AvailabilityZoneID | entity.entity.asset.attribute.labels.value | The value of AvailabilityZoneIDfrom the raw log is used as the value of a label. The key for this label is set toavailability_zone_id. | 
| AvailableCapacity.AvailableInstanceCapacity.AvailableCapacity | entity.entity.asset.attribute.labels.value | The value of AvailableCapacity.AvailableInstanceCapacity.AvailableCapacity(orAvailableCapacity.Instance.Availableafter renaming) is converted to a string and used as the value of a label. The key is set toavailable_instance_capacity_available_capacity. | 
| AvailableCapacity.AvailableInstanceCapacity.InstanceType | entity.entity.asset.attribute.labels.value | The value of AvailableCapacity.AvailableInstanceCapacity.InstanceType(orAvailableCapacity.Instance.Typeafter renaming) is used as the value of a label. The key is set toavailable_instance_capacity_instance_type. | 
| AvailableCapacity.AvailableInstanceCapacity.TotalCapacity | entity.entity.asset.attribute.labels.value | The value of AvailableCapacity.AvailableInstanceCapacity.TotalCapacity(orAvailableCapacity.Instance.Totalafter renaming) is converted to a string and used as the value of a label. The key is set tototal_capacity. | 
| AvailableCapacity.AvailableVCpus | entity.entity.asset.attribute.labels.value | The value of AvailableCapacity.AvailableVCpus(orAvailableCapacity.VCPUsafter renaming) is converted to a string and used as the value of a label. The key is set toavailable_v_cpus. | 
| ClientToken | entity.entity.asset.attribute.labels.value | The value of ClientTokenfrom the raw log is used as the value of a label. The key for this label is set toclient_token. | 
| HostID | entity.metadata.product_entity_id | The HostID(orIDafter renaming) field is directly mapped to theproduct_entity_idfield. | 
| HostID | entity.entity.asset.asset_id | The HostID(orIDafter renaming) field is directly mapped to theasset_idfield. | 
| HostMaintenance | entity.entity.asset.attribute.labels.value | The value of HostMaintenance(orMaintenanceafter renaming) from the raw log is used as the value of a label. The key for this label is set tohost_maintenance. | 
| HostProperties.Cores | entity.entity.asset.hardware.cpu_number_cores | The value of HostProperties.Coresis converted to an unsigned integer and mapped tocpu_number_cores. | 
| HostProperties.InstanceFamily | entity.entity.asset.attribute.labels.value | The value of HostProperties.InstanceFamilyfrom the raw log is used as the value of a label. The key for this label is set tohost_properties_instance_family. | 
| HostProperties.InstanceType | entity.entity.asset.attribute.labels.value | The value of HostProperties.InstanceTypefrom the raw log is used as the value of a label. The key for this label is set tohost_properties_instance_type. | 
| HostProperties.Sockets | entity.entity.asset.attribute.labels.value | The value of HostProperties.Socketsis converted to a string and used as the value of a label. The key is set tohost_properties_sockets. | 
| HostProperties.TotalVCpus | entity.entity.asset.attribute.labels.value | The value of HostProperties.TotalVCpus(orHostProperties.TotalVCPUsafter renaming) is converted to a string and used as the value of a label. The key is set tohost_properties_total_v_cpus. | 
| HostRecovery | entity.entity.asset.attribute.labels.value | The value of HostRecovery(orRecoveryafter renaming) from the raw log is used as the value of a label. The key for this label is set tohost_recovery. | 
| HostReservationID | entity.entity.asset.attribute.labels.value | The value of HostReservationID(orReservationIDafter renaming) from the raw log is used as the value of a label. The key for this label is set tohost_reservation_id. | 
| MemberOfServiceLinkedResourceGroup | entity.entity.asset.attribute.labels.value | The value of MemberOfServiceLinkedResourceGroupis converted to a string and used as the value of a label. The key is set tomember_of_service_linked_resource_group. | 
| OwnerID | entity.entity.asset.attribute.labels.value | The value of OwnerIDfrom the raw log is used as the value of a label. The key for this label is set toowner_id. | 
| ReleaseTime | entity.entity.asset.attribute.labels.value | The value of ReleaseTimefrom the raw log is used as the value of a label. The key for this label is set torelease_time. | 
| State | entity.entity.asset.attribute.labels.value | The value of Statefrom the raw log is used as the value of a label. The key for this label is set tostate. | 
| TagSet | entity.entity.asset.attribute.labels | The TagSetarray is iterated over, and each tag'sKeyandValueare used as the key and value of a label, respectively.  The valueAMAZON_WEB_SERVICESis assigned to this field by the parser. Thecollection_timefrom the raw log is mapped to thecollected_timestampfield. The valueASSETis assigned to this field by the parser. The valueAWS EC2 HOSTSis assigned to this field by the parser. The valueAWSis assigned to this field by the parser. Relations are derived fromInstancesandOutpostArnfields, but these fields themselves are not directly mapped to the IDM object. The parser logic creates relation objects based on these fields and merges them into therelationsarray. | 
| collection_time | entity.metadata.collected_timestamp | The log's collection_timeis used as the event'scollected_timestamp. | 
Need more help? Get answers from Community members and Google SecOps professionals.