Skip to content

How do I create Transit Gateway Flow Logs to monitor my network traffic?

3 minute read
0

I want to create AWS Transit Gateway Flow Logs to monitor traffic through my transit gateway.

Resolution

Requirement: You must have access to the AWS account that owns the transit gateway. If you don't have access, then ask the account owner to grant you permissions through an AWS Identity and Access Management (IAM) role.

Create an IAM policy and role for transit gateway flow logs

  1. Open the IAM console.

  2. In the navigation pane, choose Policies, and then choose Create policy.

  3. Enter the following IAM policy to allow flow logs to publish logs to the Amazon CloudWatch log group:

    {
      "Version":"2012-10-17",                   
      "Statement": [
        {
          "Effect": "Allow",
          "Action": [
            "logs:CreateLogGroup",
            "logs:CreateLogStream",
            "logs:PutLogEvents",
            "logs:DescribeLogGroups",
            "logs:DescribeLogStreams"
          ],
          "Resource": "*"
        }
      ]
    }   
  4. Enter a name and description for the policy.

  5. Choose Create policy.

  6. To create the IAM role, in the navigation pane, choose Roles.

  7. Choose Create role.

  8. For custom trust policy, choose Trusted entity type.

  9. Add the following trust policy:

    {
      "Version":"2012-10-17",                   
      "Statement": [
        {
          "Effect": "Allow",
          "Principal": {
            "Service": "vpc-flow-logs.amazonaws.com"
          },
          "Action": "sts:AssumeRole"
        }
      ]
    } 
  10. Choose Next.

  11. Search for the newly created IAM policy, and then attach it to the IAM role.

  12. Choose Next.

  13. Enter a name and description for the policy.

  14. Choose Create role.

Create a transit gateway flow log

Note: After you create a transit gateway flow log, it takes several minutes to collect and publish data to the chosen destination. Data ingestion and storage charges for vended logs occur when you publish transit gateway flow logs. To view pricing details for vended logs, see Amazon CloudWatch Pricing, and then under Paid tier, choose Logs and find Vended Logs.

Complete the following steps:

  1. Open the Amazon Virtual Private Cloud (Amazon VPC) console.
  2. In the navigation pane, choose Transit gateways.
  3. Select your transit gateway.
  4. Choose Actions, and then choose Create flow log.
  5. Enter the following information:
    For Destination, choose Send to CloudWatch Logs.
    For Destination log group, choose an existing log group name.
    Note: Specify an existing CloudWatch log group before your create flow logs. Create a log group before you proceed if a log group doesn't exist.
    For IAM role, choose the newly created IAM role.
    For Log record format, choose either AWS default format or Custom format. If you choose Custom format, then specify the flow log record fields that you want to include.
  6. (Optional) Choose Add new tag to apply tags to the flow log.
  7. Choose Create flow log.
AWS OFFICIALUpdated a year ago