FlowLogDestinationConfig Struct
Flow Log Destination configuration.
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
import { aws_s3 as s3 } from 'aws-cdk-lib';
import { aws_kinesisfirehose as interfaces_kinesisfirehose } from 'aws-cdk-lib/interfaces';
import { aws_logs as interfaces_logs } from 'aws-cdk-lib/interfaces';
declare const bucket: s3.Bucket;
declare const deliveryStreamRef: interfaces_kinesisfirehose.IDeliveryStreamRef;
declare const logGroupRef: interfaces_logs.ILogGroupRef;
declare const role: iam.Role;
const flowLogDestinationConfig: ec2.FlowLogDestinationConfig = {
logDestinationType: ec2.FlowLogDestinationType.CLOUD_WATCH_LOGS,
// the properties below are optional
deliveryStream: deliveryStreamRef,
deliveryStreamArn: 'deliveryStreamArn',
destinationOptions: {
fileFormat: ec2.FlowLogFileFormat.PLAIN_TEXT,
hiveCompatiblePartitions: false,
perHourPartition: false,
},
iamRole: role,
keyPrefix: 'keyPrefix',
logGroup: logGroupRef,
s3Bucket: bucket,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ec2 as ec2
from aws_cdk import aws_iam as iam
from aws_cdk import aws_s3 as s3
from aws_cdk.interfaces import aws_kinesisfirehose as interfaces_kinesisfirehose
from aws_cdk.interfaces import aws_logs as interfaces_logs
# bucket: s3.Bucket
# delivery_stream_ref: interfaces_kinesisfirehose.IDeliveryStreamRef
# log_group_ref: interfaces_logs.ILogGroupRef
# role: iam.Role
flow_log_destination_config = ec2.FlowLogDestinationConfig(
log_destination_type=ec2.FlowLogDestinationType.CLOUD_WATCH_LOGS,
# the properties below are optional
delivery_stream=delivery_stream_ref,
delivery_stream_arn="deliveryStreamArn",
destination_options=ec2.DestinationOptions(
file_format=ec2.FlowLogFileFormat.PLAIN_TEXT,
hive_compatible_partitions=False,
per_hour_partition=False
),
iam_role=role,
key_prefix="keyPrefix",
log_group=log_group_ref,
s3_bucket=bucket
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ec2.*;
import software.amazon.awscdk.services.iam.*;
import software.amazon.awscdk.services.s3.*;
import software.amazon.awscdk.interfaces.kinesisfirehose.*;
import software.amazon.awscdk.interfaces.logs.*;
Bucket bucket;
IDeliveryStreamRef deliveryStreamRef;
ILogGroupRef logGroupRef;
Role role;
FlowLogDestinationConfig flowLogDestinationConfig = FlowLogDestinationConfig.builder()
.logDestinationType(FlowLogDestinationType.CLOUD_WATCH_LOGS)
// the properties below are optional
.deliveryStream(deliveryStreamRef)
.deliveryStreamArn("deliveryStreamArn")
.destinationOptions(DestinationOptions.builder()
.fileFormat(FlowLogFileFormat.PLAIN_TEXT)
.hiveCompatiblePartitions(false)
.perHourPartition(false)
.build())
.iamRole(role)
.keyPrefix("keyPrefix")
.logGroup(logGroupRef)
.s3Bucket(bucket)
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.IAM;
using Amazon.CDK.AWS.S3;
using Amazon.CDK.Interfaces.KinesisFirehose;
using Amazon.CDK.Interfaces.Logs;
Bucket bucket;
IDeliveryStreamRef deliveryStreamRef;
ILogGroupRef logGroupRef;
Role role;
var flowLogDestinationConfig = new FlowLogDestinationConfig {
LogDestinationType = FlowLogDestinationType.CLOUD_WATCH_LOGS,
// the properties below are optional
DeliveryStream = deliveryStreamRef,
DeliveryStreamArn = "deliveryStreamArn",
DestinationOptions = new DestinationOptions {
FileFormat = FlowLogFileFormat.PLAIN_TEXT,
HiveCompatiblePartitions = false,
PerHourPartition = false
},
IamRole = role,
KeyPrefix = "keyPrefix",
LogGroup = logGroupRef,
S3Bucket = bucket
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var bucket Bucket
var deliveryStreamRef IDeliveryStreamRef
var logGroupRef ILogGroupRef
var role Role
flowLogDestinationConfig := &FlowLogDestinationConfig{
LogDestinationType: awscdk.Aws_ec2.FlowLogDestinationType_CLOUD_WATCH_LOGS,
// the properties below are optional
DeliveryStream: deliveryStreamRef,
DeliveryStreamArn: jsii.String("deliveryStreamArn"),
DestinationOptions: &DestinationOptions{
FileFormat: awscdk.*Aws_ec2.FlowLogFileFormat_PLAIN_TEXT,
HiveCompatiblePartitions: jsii.Boolean(false),
PerHourPartition: jsii.Boolean(false),
},
IamRole: role,
KeyPrefix: jsii.String("keyPrefix"),
LogGroup: logGroupRef,
S3Bucket: bucket,
}
Properties
deliveryStreamoptionalIDeliveryStreamRefdelivery_streamoptionalIDeliveryStreamRefdeliveryStreamoptionalIDeliveryStreamRefDeliveryStreamoptionalIDeliveryStreamRefDeliveryStreamoptionalIDeliveryStreamRef= undefined#The Amazon Data Firehose delivery stream to publish the flow logs to.
deliveryStreamArnoptionalstringdelivery_stream_arnoptionalstrdeliveryStreamArnoptionalStringDeliveryStreamArnoptionalstringDeliveryStreamArnoptional*string= undefineddeprecated#use deliveryStream
destinationOptionsoptionalDestinationOptionsdestination_optionsoptionalDestinationOptionsdestinationOptionsoptionalDestinationOptionsDestinationOptionsoptionalDestinationOptionsDestinationOptionsoptionalDestinationOptions= undefined#Options for writing flow logs to a supported destination.
iamRoleoptionalIRoleiam_roleoptionalIRoleiamRoleoptionalIRoleIamRoleoptionalIRoleIamRoleoptionalIRole#The IAM role that allows Amazon EC2 to publish flow logs to the log destination.
Default: default IAM role is created for you if the destination type is CloudWatch logs
Required if the destination type is CloudWatch logs, or if the destination type is Amazon Data Firehose delivery stream and the delivery stream and the VPC are in different accounts.
keyPrefixoptionalstringkey_prefixoptionalstrkeyPrefixoptionalStringKeyPrefixoptionalstringKeyPrefixoptional*string= undefined#S3 bucket key prefix to publish the flow logs to.
logDestinationTypeFlowLogDestinationTypelog_destination_typeFlowLogDestinationTypelogDestinationTypeFlowLogDestinationTypeLogDestinationTypeFlowLogDestinationTypeLogDestinationTypeFlowLogDestinationType= CLOUD_WATCH_LOGSrequired#The type of destination to publish the flow logs to.
logGroupoptionalILogGroupReflog_groupoptionalILogGroupReflogGroupoptionalILogGroupRefLogGroupoptionalILogGroupRefLogGroupoptionalILogGroupRef#The CloudWatch Logs Log Group to publish the flow logs to.
Default: default log group is created for you