Class FlowLogDestination
The destination type for the flow log.
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public abstract class FlowLogDestination : DeputyBase
Syntax (vb)
Public MustInherit Class FlowLogDestination Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
Vpc vpc;
var logGroup = new LogGroup(this, "MyCustomLogGroup");
var role = new Role(this, "MyCustomRole", new RoleProps {
AssumedBy = new ServicePrincipal("vpc-flow-logs.amazonaws.com")
});
new FlowLog(this, "FlowLog", new FlowLogProps {
ResourceType = FlowLogResourceType.FromVpc(vpc),
Destination = FlowLogDestination.ToCloudWatchLogs(logGroup, role)
});
Synopsis
Constructors
| FlowLogDestination() | The destination type for the flow log. |
Methods
| Bind(Construct, FlowLog) | Generates a flow log destination configuration. |
| ToCloudWatchLogs(ILogGroupRef?, IRole?) | Use CloudWatch logs as the destination. |
| ToFirehose(IDeliveryStreamRef, IRole?) | Use Amazon Data Firehose as the destination. |
| ToKinesisDataFirehoseDestination(string) | (deprecated) Use Amazon Data Firehose as the destination. |
| ToS3(IBucket?, string?, IS3DestinationOptions?) | Use S3 as the destination. |
Constructors
FlowLogDestination()
The destination type for the flow log.
protected FlowLogDestination()
Remarks
ExampleMetadata: infused
Examples
Vpc vpc;
var logGroup = new LogGroup(this, "MyCustomLogGroup");
var role = new Role(this, "MyCustomRole", new RoleProps {
AssumedBy = new ServicePrincipal("vpc-flow-logs.amazonaws.com")
});
new FlowLog(this, "FlowLog", new FlowLogProps {
ResourceType = FlowLogResourceType.FromVpc(vpc),
Destination = FlowLogDestination.ToCloudWatchLogs(logGroup, role)
});
Methods
Bind(Construct, FlowLog)
Generates a flow log destination configuration.
public abstract IFlowLogDestinationConfig Bind(Construct scope, FlowLog flowLog)
Parameters
- scope Construct
- flowLog FlowLog
Returns
Remarks
ExampleMetadata: infused
ToCloudWatchLogs(ILogGroupRef?, IRole?)
Use CloudWatch logs as the destination.
public static FlowLogDestination ToCloudWatchLogs(ILogGroupRef? logGroup = null, IRole? iamRole = null)
Parameters
- logGroup ILogGroupRef
- iamRole IRole
Returns
Remarks
ExampleMetadata: infused
ToFirehose(IDeliveryStreamRef, IRole?)
Use Amazon Data Firehose as the destination.
public static FlowLogDestination ToFirehose(IDeliveryStreamRef deliveryStream, IRole? iamRole = null)
Parameters
- deliveryStream IDeliveryStreamRef
the Amazon Data Firehose delivery stream to publish logs to.
- iamRole IRole
the IAM Role for cross account log delivery.
Returns
Remarks
If the delivery stream and the VPC are in different account, you must specify iamRole.
See: https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs-firehose.html
ToKinesisDataFirehoseDestination(string)
(deprecated) Use Amazon Data Firehose as the destination.
[Obsolete("use `toFirehose`")]
public static FlowLogDestination ToKinesisDataFirehoseDestination(string deliveryStreamArn)
Parameters
- deliveryStreamArn string
the ARN of Amazon Data Firehose delivery stream to publish logs to.
Returns
Remarks
Stability: Deprecated
ToS3(IBucket?, string?, IS3DestinationOptions?)
Use S3 as the destination.
public static FlowLogDestination ToS3(IBucket? bucket = null, string? keyPrefix = null, IS3DestinationOptions? options = null)
Parameters
- bucket IBucket
optional s3 bucket to publish logs to.
- keyPrefix string
optional prefix within the bucket to write logs to.
- options IS3DestinationOptions
additional s3 destination options.
Returns
Remarks
ExampleMetadata: infused