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 Kinesis 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.
CloudWatchLogs(logGroup?, iamRole?)
static topublic static toCloudWatchLogs(logGroup?: ILogGroup, iamRole?: IRole): FlowLogDestination
Parameters
Returns
Use CloudWatch logs as the destination.
KinesisDataFirehoseDestination(deliveryStreamArn)
static topublic static toKinesisDataFirehoseDestination(deliveryStreamArn: string): FlowLogDestination
Parameters
- deliveryStreamArn
string
— the ARN of Kinesis Data Firehose delivery stream to publish logs to.
Returns
Use Kinesis Data Firehose as the destination.
S3(bucket?, keyPrefix?, options?)
static topublic 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.