Carina

Resource

aws.ec2.FlowLog

Describes a flow log.

Example

let vpc = aws.ec2.Vpc {
  cidr_block = '10.0.0.0/16'

  tags = {
    Environment = 'example'
  }
}

let flow_log_bucket = aws.s3.Bucket {
  bucket = 'carina-example-vpc-flow-logs'

  tags = {
    Environment = 'example'
  }
}

aws.ec2.FlowLog {
  resource_ids         = [vpc.vpc_id]
  resource_type        = aws.ec2.FlowLog.ResourceType.vpc
  traffic_type         = aws.ec2.FlowLog.TrafficType.all
  log_destination_type = aws.ec2.FlowLog.LogDestinationType.s3
  log_destination      = flow_log_bucket.arn

  tags = {
    Environment = 'example'
  }
}

Argument Reference

deliver_logs_permission_arn

The ARN of the IAM role that allows Amazon EC2 to publish flow logs to the log destination. This parameter is required if the destination type is cloud-watch-logs, or if the destination type is kinesis-data-firehose and the delivery stream and the resources to monitor are in different accounts.

log_destination

The destination for the flow log data. The meaning of this parameter depends on the destination type. If the destination type is cloud-watch-logs, specify the ARN of a CloudWatch Logs log group. For example: arn:aws:logs:region:account_id:log-group:my_group Alternatively, use the LogGroupName parameter. If the destination type is s3, specify the ARN of an S3 bucket. For example: arn:aws:s3:::my_bucket/my_subfolder/ The subfolder is optional. Note that you can't use AWSLogs as a subfolder name. If the destination type is kinesis-data-firehose, specify the ARN of a Kinesis Data Firehose delivery stream. For example: arn:aws:firehose:region:account_id:deliverystream:my_stream

log_destination_type

The type of destination for the flow log data. Default: cloud-watch-logs

log_format

The fields to include in the flow log record. List the fields in the order in which they should appear. If you omit this parameter, the flow log is created using the default format. If you specify this parameter, you must include at least one field. For more information about the available fields, see Flow log records in the Amazon VPC User Guide or Transit Gateway Flow Log records in the Amazon Web Services Transit Gateway Guide. Specify the fields using the ${field-id} format, separated by spaces.

log_group_name

The name of a new or existing CloudWatch Logs log group where Amazon EC2 publishes your flow logs. This parameter is valid only if the destination type is cloud-watch-logs.

max_aggregation_interval

The maximum interval of time during which a flow of packets is captured and aggregated into a flow log record. The possible values are 60 seconds (1 minute) or 600 seconds (10 minutes). This parameter must be 60 seconds for transit gateway resource types. When a network interface is attached to a Nitro-based instance, the aggregation interval is always 60 seconds or less, regardless of the value that you specify. Default: 600

resource_ids

The IDs of the resources to monitor. For example, if the resource type is VPC, specify the IDs of the VPCs. Constraints: Maximum of 25 for transit gateway resource types. Maximum of 300 for the other resource types.

resource_type

The type of resource to monitor.

tag_field_specifications

The tag configuration associated with the Flow Logs Amazon EC2 Tags feature fields in your custom log format.

traffic_type

The type of traffic to monitor (accepted traffic, rejected traffic, or all traffic). This parameter is not supported for transit gateway resource types. It is required for the other resource types.

tags

The tags for the resource.

Enum Values

log_destination_type (LogDestinationType)

Value DSL Identifier
cloud-watch-logs aws.ec2.FlowLog.LogDestinationType.cloud_watch_logs
kinesis-data-firehose aws.ec2.FlowLog.LogDestinationType.kinesis_data_firehose
s3 aws.ec2.FlowLog.LogDestinationType.s3

Shorthand formats: cloud_watch_logs or LogDestinationType.cloud_watch_logs

resource_type (ResourceType)

Value DSL Identifier
NetworkInterface aws.ec2.FlowLog.ResourceType.network_interface
RegionalNatGateway aws.ec2.FlowLog.ResourceType.regional_nat_gateway
Subnet aws.ec2.FlowLog.ResourceType.subnet
TransitGateway aws.ec2.FlowLog.ResourceType.transit_gateway
TransitGatewayAttachment aws.ec2.FlowLog.ResourceType.transit_gateway_attachment
VPC aws.ec2.FlowLog.ResourceType.vpc

Shorthand formats: network_interface or ResourceType.network_interface

tag_field_specifications[].resource_type (ResourceType)

Value DSL Identifier
auto-scaling-group aws.ec2.FlowLog.TagFieldSpecificationRequest.ResourceType.auto_scaling_group
instance aws.ec2.FlowLog.TagFieldSpecificationRequest.ResourceType.instance
network-interface aws.ec2.FlowLog.TagFieldSpecificationRequest.ResourceType.network_interface

Shorthand formats: auto_scaling_group or ResourceType.auto_scaling_group

traffic_type (TrafficType)

Value DSL Identifier
ACCEPT aws.ec2.FlowLog.TrafficType.accept
ALL aws.ec2.FlowLog.TrafficType.all
REJECT aws.ec2.FlowLog.TrafficType.reject

Shorthand formats: accept or TrafficType.accept

Struct Definitions

tag_field_specifications[]

Field Type Required Description
resource_type ResourceType No The resource type for the tag keys associated with the Flow Logs Amazon EC2 Tags feature fields in your custom log format.
tag_keys List<String (len: 1..=128)> (items: 1..=2, ordered) No The tag keys on your tagged resources to be displayed by the Flow Logs Amazon EC2 Tags feature fields in your custom log format.

Additional Input Constraints

Attribute Applies on Additional constraint
log_format Create only String (pattern: /^\$\{[a-z0-9]+(?:-[a-z0-9]+)*\}(?: +\$\{[a-z0-9]+(?:-[a-z0-9]+)*\})*\z/ (Full))
log_group_name Create only String (pattern: /^[.\-_/#A-Za-z0-9]{1,512}\z/ (Full))

Attribute Reference

flow_log_id

The ID of the flow log.