FlowLogDestination

class aws_cdk.aws_ec2.FlowLogDestination

Bases: object

The destination type for the flow log.

ExampleMetadata:

infused

Example:

# vpc: ec2.Vpc


log_group = logs.LogGroup(self, "MyCustomLogGroup")

role = iam.Role(self, "MyCustomRole",
    assumed_by=iam.ServicePrincipal("vpc-flow-logs.amazonaws.com")
)

ec2.FlowLog(self, "FlowLog",
    resource_type=ec2.FlowLogResourceType.from_vpc(vpc),
    destination=ec2.FlowLogDestination.to_cloud_watch_logs(log_group, role)
)

Methods

abstract bind(scope, flow_log)

Generates a flow log destination configuration.

Parameters:
Return type:

FlowLogDestinationConfig

Static Methods

classmethod to_cloud_watch_logs(log_group=None, iam_role=None)

Use CloudWatch logs as the destination.

Parameters:
Return type:

FlowLogDestination

classmethod to_kinesis_data_firehose_destination(delivery_stream_arn)

Use Kinesis Data Firehose as the destination.

Parameters:

delivery_stream_arn (str) – the ARN of Kinesis Data Firehose delivery stream to publish logs to.

Return type:

FlowLogDestination

classmethod to_s3(bucket=None, key_prefix=None, *, file_format=None, hive_compatible_partitions=None, per_hour_partition=None)

Use S3 as the destination.

Parameters:
  • bucket (Optional[IBucket]) – optional s3 bucket to publish logs to. If one is not provided a default bucket will be created

  • key_prefix (Optional[str]) – optional prefix within the bucket to write logs to.

  • file_format (Optional[FlowLogFileFormat]) – The format for the flow log. Default: FlowLogFileFormat.PLAIN_TEXT

  • hive_compatible_partitions (Optional[bool]) – Use Hive-compatible prefixes for flow logs stored in Amazon S3. Default: false

  • per_hour_partition (Optional[bool]) – Partition the flow log per hour. Default: false

Return type:

FlowLogDestination