Create a flow log that publishes to Amazon Data Firehose - Amazon Virtual Private Cloud

Create a flow log that publishes to Amazon Data Firehose

You can create flow logs for your VPCs, subnets, or network interfaces.

Prerequisites
To create a flow log that publishes to Amazon Data Firehose
  1. Do one of the following:

  2. Choose Actions, Create flow log.

  3. For Filter, specify the type of traffic to log.

    • Accept – Log only accepted traffic

    • Reject – Log only rejected traffic

    • All – Log accepted and rejected traffic

  4. For Maximum aggregation interval, choose the maximum period of time during which a flow is captured and aggregated into one flow log record.

  5. For Destination, choose either of the following options:

    • Send to Amazon Data Firehose in the same account – The delivery stream and the resource to monitor are in the same account.

    • Send to Amazon Data Firehose in a different account – The delivery stream and the resource to monitor are in different accounts.

  6. For Amazon Data Firehose stream name, choose the delivery stream that you created.

  7. [Cross account delivery only] For IAM roles, specify the required roles (see IAM roles for cross account delivery).

  8. For Log record format, specify the format for the flow log record.

    • To use the default flow log record format, choose AWS default format.

    • To create a custom format, choose Custom format. For Log format, choose the fields to include in the flow log record.

  9. For Additional metadata, select if you want to include metadata from Amazon ECS in the log format.

  10. (Optional) Choose Add tag to apply tags to the flow log.

  11. Choose Create flow log.

To create a flow log that publishes to Amazon Data Firehose using the command line

Use one of the following commands:

The following AWS CLI example creates a flow log that captures all traffic for the specified VPC and delivers the flow logs to the specified Amazon Data Firehose delivery stream in the same account.

aws ec2 create-flow-logs --traffic-type ALL \ --resource-type VPC \ --resource-ids vpc-00112233344556677 \ --log-destination-type kinesis-data-firehose \ --log-destination arn:aws:firehose:us-east-1:123456789012:deliverystream/flowlogs_stream

The following AWS CLI example creates a flow log that captures all traffic for the specified VPC and delivers the flow logs to the specified Amazon Data Firehose delivery stream in a different account.

aws ec2 create-flow-logs --traffic-type ALL \ --resource-type VPC \ --resource-ids vpc-00112233344556677 \ --log-destination-type kinesis-data-firehose \ --log-destination arn:aws:firehose:us-east-1:123456789012:deliverystream/flowlogs_stream \ --deliver-logs-permission-arn arn:aws:iam::source-account:role/mySourceRole \ --deliver-cross-account-role arn:aws:iam::destination-account:role/AWSLogDeliveryFirehoseCrossAccountRole

As a result of creating the flow log, you can get the flow log data from the destination that you configured for the delivery stream.