class FlowLogDestination
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.EC2.FlowLogDestination |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsec2#FlowLogDestination |
Java | software.amazon.awscdk.services.ec2.FlowLogDestination |
Python | aws_cdk.aws_ec2.FlowLogDestination |
TypeScript (source) | aws-cdk-lib » aws_ec2 » FlowLogDestination |
The destination type for the flow log.
Example
declare const vpc: ec2.Vpc;
const logGroup = new logs.LogGroup(this, 'MyCustomLogGroup');
const role = new iam.Role(this, 'MyCustomRole', {
assumedBy: new iam.ServicePrincipal('vpc-flow-logs.amazonaws.com')
});
new ec2.FlowLog(this, 'FlowLog', {
resourceType: ec2.FlowLogResourceType.fromVpc(vpc),
destination: ec2.FlowLogDestination.toCloudWatchLogs(logGroup, role)
});
Initializer
new FlowLogDestination()
Methods
| Name | Description |
|---|---|
| bind(scope, flowLog) | Generates a flow log destination configuration. |
| static to | Use CloudWatch logs as the destination. |
| static to | Use Amazon Data Firehose as the destination. |
| static to | Use Amazon Data Firehose as the destination. |
| static to | Use S3 as the destination. |
bind(scope, flowLog)
public bind(scope: Construct, flowLog: FlowLog): FlowLogDestinationConfig
Parameters
Returns
Generates a flow log destination configuration.
static toCloudWatchLogs(logGroup?, iamRole?)
public static toCloudWatchLogs(logGroup?: ILogGroupRef, iamRole?: IRole): FlowLogDestination
Parameters
- logGroup
ILogGroup Ref - iamRole
IRole
Returns
Use CloudWatch logs as the destination.
static toFirehose(deliveryStream, iamRole?)
public static toFirehose(deliveryStream: IDeliveryStreamRef, iamRole?: IRole): FlowLogDestination
Parameters
- deliveryStream
IDelivery— the Amazon Data Firehose delivery stream to publish logs to.Stream Ref - iamRole
IRole— the IAM Role for cross account log delivery.
Returns
Use Amazon Data Firehose as the destination.
If the delivery stream and the VPC are in different account, you must specify iamRole.
See also: https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs-firehose.html
static toKinesisDataFirehoseDestination(deliveryStreamArn)
public static toKinesisDataFirehoseDestination(deliveryStreamArn: string): FlowLogDestination
⚠️ Deprecated: use toFirehose
Parameters
- deliveryStreamArn
string— the ARN of Amazon Data Firehose delivery stream to publish logs to.
Returns
Use Amazon Data Firehose as the destination.
static toS3(bucket?, keyPrefix?, options?)
public static toS3(bucket?: IBucket, keyPrefix?: string, options?: S3DestinationOptions): FlowLogDestination
Parameters
- bucket
IBucket— optional s3 bucket to publish logs to. - keyPrefix
string— optional prefix within the bucket to write logs to. - options
S3— additional s3 destination options.Destination Options
Returns
Use S3 as the destination.

.NET
Go
Java
Python
TypeScript (