aws-cdk-lib.aws_ec2.FlowLogResourceType

class FlowLogResourceType

LanguageType name
.NETAmazon.CDK.AWS.EC2.FlowLogResourceType
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsec2#FlowLogResourceType
Javasoftware.amazon.awscdk.services.ec2.FlowLogResourceType
Pythonaws_cdk.aws_ec2.FlowLogResourceType
TypeScript (source)aws-cdk-lib » aws_ec2 » FlowLogResourceType

The type of resource to create the flow log for.

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 FlowLogResourceType()

Properties

NameTypeDescription
resourceIdstringThe Id of the resource that the flow log should be attached to.
resourceTypestringThe type of resource to attach a flow log to.

resourceId

Type: string

The Id of the resource that the flow log should be attached to.


resourceType

Type: string

The type of resource to attach a flow log to.

Methods

NameDescription
static fromNetworkInterfaceId(id)The Network Interface to attach the Flow Log to.
static fromSubnet(subnet)The subnet to attach the Flow Log to.
static fromVpc(vpc)The VPC to attach the Flow Log to.

static fromNetworkInterfaceId(id)

public static fromNetworkInterfaceId(id: string): FlowLogResourceType

Parameters

  • id string

Returns

  • FlowLogResourceType

The Network Interface to attach the Flow Log to.


static fromSubnet(subnet)

public static fromSubnet(subnet: ISubnet): FlowLogResourceType

Parameters

  • subnet ISubnet

Returns

  • FlowLogResourceType

The subnet to attach the Flow Log to.


static fromVpc(vpc)

public static fromVpc(vpc: IVpc): FlowLogResourceType

Parameters

  • vpc IVpc

Returns

  • FlowLogResourceType

The VPC to attach the Flow Log to.