HEX
Server: LiteSpeed
System: Linux ip-172-31-76-142.ec2.internal 4.14.158-129.185.amzn2.x86_64 #1 SMP Tue Dec 24 03:15:32 UTC 2019 x86_64
User: 69b4844ae61d4e92bf26ad98af552775 (1065)
PHP: 7.2.27
Disabled: exec,passthru,shell_exec,system,eval
Upload Files
File: //proc/thread-self/root/lib/python2.7/site-packages/awscli/examples/ec2/create-flow-logs.rst
**Example 1: To create a flow log**

The following ``create-flow-logs`` example creates a flow log that captures all rejected traffic for the specified network interface. The flow logs are delivered to a log group in CloudWatch Logs using the permissions in the specified IAM role. ::

    aws ec2 create-flow-logs \
        --resource-type NetworkInterface \
        --resource-ids eni-11223344556677889 \
        --traffic-type REJECT \
        --log-group-name my-flow-logs \
        --deliver-logs-permission-arn arn:aws:iam::123456789101:role/publishFlowLogs

Output::

    {
        "ClientToken": "so0eNA2uSHUNlHI0S2cJ305GuIX1CezaRdGtexample",
        "FlowLogIds": [
            "fl-12345678901234567"
        ],
        "Unsuccessful": []
    }

**Example 2: To create a flow log with a custom format**

The following ``create-flow-logs`` example creates a flow log that captures all traffic for the specified VPC and delivers the flow logs to an Amazon S3 bucket. The ``--log-format`` parameter specifies a custom format for the flow log records. ::

    aws ec2 create-flow-logs \
        --resource-type VPC \
        --resource-ids vpc-00112233344556677 \
        --traffic-type ALL \
        --log-destination-type s3 \
        --log-destination arn:aws:s3:::flow-log-bucket/my-custom-flow-logs/ \
        --log-format '${version} ${vpc-id} ${subnet-id} ${instance-id} ${srcaddr} ${dstaddr} ${srcport} ${dstport} ${protocol} ${tcp-flags} ${type} ${pkt-srcaddr} ${pkt-dstaddr}'

For more information, see `VPC Flow Logs <https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html>`__ in the *Amazon VPC User Guide*.