Document toolboxDocument toolbox

AWS collector

Service description

Amazon Web Services (AWS) provides on-demand cloud computing platforms and APIs to individuals and companies. Each available AWS service generates information related to different aspects of its functionality. The AWS collector will use some of the available AWS APIs for retrieving this information and sending it to the Devo platform.

You can use the AWS collector to send this information to your Devo domain. Once the gathered information arrives at Devo, it will be processed and included in different tables in the associated Devo domain.

Data source description

From the monitoring point of view, AWS generates the following types of information:

Events

Information that happens at a specific timestamp. This information will always be joined to that timestamp, and can be categorized into two different subtypes:

Service events

The different available services usually generate information related to their internal behaviors, such as A virtual machine has been started, A new file has been created in an S3 bucket or An AWS lambda function has been invoked.

Note that this type of event can be triggered with no human interaction. These kinds of events are managed by the CloudWatch Events service (CWE).

Audit events

These events are more specific because they need human interaction no matter the different ways used (API, web interaction, or even CLI command). These events are managed by the CloudTrail service.

Metrics

According to the standard definition, this kind of information is usually generated at the same moment it is requested because it is usually a query about the status of a service (all things inside AWS are considered services).

AWS makes something slightly different because it generates metrics information every N time slots, such as 1 min, 5 min, 30 min, 1h, etc., even if no one makes a request (it is also possible to have information every X seconds but this would require an extra cost). This kind of information is managed by the CloudWatch Metrics service (CWM).

Logs

Logs can be defined as information with a non-fixed structure that is sent to one of the available “logging” services. These services are CloudWatch Logs and S3.

There are some very customizable services, such as AWS Lambda, or even any developed application which is deployed inside an AWS virtual machine (EC2), that can generate custom log information. This kind of information is managed by the CloudWatch Logs service (CWL) and also by the S3 service. There are also some other services that can generate logs with a fixed structure, such as VPC Flow Logs or CloudFront Logs. These kinds of services require one special way of collecting their data.

Some services generate information that can be sent to different targets at the same time, for example, the CloudTrail service generates audit-related information. This information is really an "audit event", but it can be treated as a "simple event" and being sent to the Cloudwatch Events service. Also, it can be sent as a string “logline” to the Cloudwatch Logs service or sent as a file to a bucket inside the S3 service.

  • Almost all services that generate Service events usually send them to Cloudwatch Events service (CWE). It could be said that 90% of services use CloudWatch Events.

  • CloudWatch Events is in the process of changing its name, the new one is Amazon EventBridge.

Setup

Some manual actions are necessary in order to get all the required information/services and allow the Devo collector to gather the information from AWS. The following sections describe how to get the required AWS credentials and how to proceed with the different required setups depending on the gathered information type.

Credentials

The AWS collector requires a valid AWS Access Key to start working. To create it, please visit the AWS Console and log in with a user account with enough permissions to create/access AWS structures (depending on whether or not the auto-setup functionality will be used). Then, follow these steps:

  1. Go to IAM → Users

  2. Find your user and click on it.

  3. Select the Security credentials tab and click Create access key.

  4. Copy and save the Access key ID and the Secret access key to use them later in the collector configuration, in the access_key and access_secret fields.

Service events

All service events are managed by the AWS CloudWatch service. This service brings together all service events that are generated by most of the AWS services.

The AWS services generate service events per region, so the next instructions should be applied in each region where the collecting of information is required (use the same values for all your configured regions).

In order to collect these service events, there are some structures that must be created: one FIFO queue in the SQS service and one Rule+Target in the CloudWatch service.

For a manual creation of these required structures, follow the next steps (click to expand):

  1. Go to Simple Queue Service and click Create queue.

  2. In the Details section, choose the FIFO queue type and set the Name field value you prefer (it must finish with the .fifo suffix).

  3. In the Configuration section, set the Message retention period field value to 5 Days. Be sure that the Content-based deduplication checkbox is marked and leave the rest of the options with their default values.

  4. In the Access policy section, choose the method Basic and select the option Only the queue owner to receive and send permissions.

  5. Optionally, in the Tags section, you can create a tag with Key usedBy and Value devo-collector.

  6. Click Create queue.

  1. Go to CloudWatch → Rules and click Create rule.

  2. In the Event Source section, select Event Pattern and Build event pattern to match events by service.

  3. In the Service Name field, enter the service to be monitored. 

  4. In the Event Type field, choose All Events.

  5. In the Targets section, click Add target and choose SQS queue as the target type.

  6. In the Queue dropdown, choose the previously created queue.

  7. In the Message group ID field, set the value devo-collector.

  8. Then, click Configure details.

  9. In the Rule definition section, set the Name you prefer. Be sure that State checkbox is marked.

Audit events

No actions are required in the Cloudtrail service to retrieve this kind of information.

Metrics

No actions are required in the CloudWatch Metrics service to retrieve this kind of information.

Logs

Logs can be collected from different services. Depending on the service type, you may need to apply some settings on AWS:

CloudWatch Logs

No actions are required in this service to retrieve this kind of information.

VPC Flow Logs

Before enabling the generation of these logs, you must create one bucket in the S3 service and one FIFO queue in the SQS service. For a manual creation of these required structures, follow these steps (click to expand):

  1. Go to Simple Queue Service and click Create queue.

  2. In the Details section, choose the Standard queue type and set the Name field value you prefer.

  3. In the Configuration section, set the Message retention period field value to 5 Days and leave the rest of the options with their default values.

  4. In the Access policy section, choose the method Advanced and replace "Principal": {"AWS":"<account_id>"} by "Principal": "*" Leave the rest of the JSON as default.

  5. Optionally, in the Tags section, you can create a tag with Key usedBy and Value devo-collector.

  6. Click Create queue.

  1. Go to S3 and click Create bucket.

  2. Set the preferred value in the Bucket name field.

  3. Choose the required Region value and click Next.

  4. Optionally, in the Tags section, you can create a tag with Key usedBy and Value devo-collector. Leave the rest of the fields with their default values and click Next.

  5. Click Create bucket.

  6. Mark the checkbox next to the previously created S3 bucket.

  7. In the popup box, click Copy Bucket ARN and save the content. You will need it later.

  8. In the S3 bucket list, click the previously created bucket name link.

  9. Click the Properties tab, then click the Events box.

  10. Click Add notification.

  11. Set the preferred value in the Name field.

  12. Select the All object create events checkbox.

  13. In the Send to field, select SQS Queue.

  14. Select the previously created SQS queue in the SQS field.

Once the required AWS structures are created, go to the VPC service and follow these steps:

  1. Select any available VPC (or create a new one).

  2. Go to the Flow Logs tab and click Create flow log.

  3. Choose the preferred Filter value and the required Maximum aggregation interval value.

  4. In the Destination field, select Send to an S3 bucket.

  5. In the S3 bucket ARN field set the ARN of the previously created S3 bucket.

  6. Make sure that the Format field has the value AWS default format.

  7. Optionally, in the Tags section, you can create a tag with Key usedBy and Value devo-collector.

  8. Finally, click Create.

CloudFront Logs

Before enabling the generation of these logs, you must create one bucket in the S3 service and one FIFO queue in the SQS service. For a manual creation of these required structures, follow these steps (click to expand):

Collector service details

The following tables show details about the predefined services available to be used in the collector configuration.

Devo collector service name

Complete service name

CloudWatch filter used

CloudTrail source filter used

Metrics namespace used

Description

Service events
(type: events)

Audit events
(type: audits)

Metrics
(type: metrics)

Logs
(type: logs)

Devo collector service name

Complete service name

CloudWatch filter used

CloudTrail source filter used

Metrics namespace used

Description

Service events
(type: events)

Audit events
(type: audits)

Metrics
(type: metrics)

Logs
(type: logs)

service-events-all

All service events

{"account":["<account_id>"]}

N/A

N/A

This service will collect all service events information available in the CloudWatch service, no matter the source defined in the event.

X

X

X

audit-events-all

All audit events

N/A

all_sources

N/A

This service will collect all audit events information available in the CloudTrail service, no matter the source defined in the event.

X

X

X

metrics-all

All metrics

N/A

N/A

all_metrics_namespaces

This service will collect all metric information from CloudWatch service. Metrics from all the available metric namespaces will be retrieved.

X

X

X

<cwl_custom>

CloudWatch Logs

N/A

N/A

N/A

This service will collect the different “Log Streams” that are part of a “Log Group” from the CloudWatch Logs service. Since it is common to have more than one “Log Group” defined, this will require creating one <cwl_custom> entry per “Log Group”.

X

X

X

non-cloudwatch-logs

Non-CloudWatch Logs

N/A

N/A

N/A

This service will collect data from the following services VPC Flow Logs and CloudFront Logs.

X

X

X

Collector configuration details

Depending on the data type chosen for collecting, the following service definitions could be added to the configuration inside the services section. The following are common properties that all services have:

  • regions (mandatory) - It must be a list with valid target region names to be used when collecting data. One processing thread will be created per region. See more info about the available regions here.

  • request_period_in_seconds (optional) - The period in seconds to be used between pulling executions (default value: 60)

  • pull_retries (optional) - Number of retries that will be executed when a pulling error occurs (default value: 3)

  • tag (optional) - Used for sending the data to a table different from the default one (in the configuration examples, they appear as commented lines).

Global predefined services

These service definitions can be used for collecting in a global way the different data types available in AWS.

All service events

service-events-all: #tag: my.app.aws_service_events regions: - <region_a> - <region_b> - <region_c>

All audit events

audit-events-all: #tag: my.app.aws_audit_events regions: - <region_a> - <region_b> - <region_c>

All metrics

metrics-all: #tag: my.app.aws_metrics regions: - <region_a> - <region_b> - <region_c>

CloudWatch Logs

An entry per Log Stream that wanted to be processed must be defined. In this example, two different entries have been created (cwl_1, cwl_2) for processing the Log Streams called /aws/log_stream_a and /aws/log_stream_b

Non-CloudWatch Logs

Run the collector

Once the data source is configured, you can send us the required information and we will host and manage the collector for you (Cloud collector), or you can host the collector in your own machine using a Docker image (On-premise collector).