# FlowLogResourceType

The type of resource to create the flow log for.

Obtainable from: FlowLogResourceType.fromNetworkInterfaceId, FlowLogResourceType.fromSubnet, FlowLogResourceType.fromTransitGatewayAttachmentId, FlowLogResourceType.fromTransitGatewayId, FlowLogResourceType.fromVpc

- Source: [`aws-ec2/lib/vpc-flow-logs.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-ec2/lib/vpc-flow-logs.ts#L89)
- Type last changed: v2.224.0 · 13 Nov 2025

## Example

TypeScript:

```ts
declare const tgw: ec2.CfnTransitGateway;

new ec2.FlowLog(this, 'TransitGatewayFlowLog', {
  resourceType: ec2.FlowLogResourceType.fromTransitGatewayId(tgw.ref)
})
```

Python:

```python
# tgw: ec2.CfnTransitGateway

ec2.FlowLog(self, "TransitGatewayFlowLog",
    resource_type=ec2.FlowLogResourceType.from_transit_gateway_id(tgw.ref)
)
```

Java:

```java
CfnTransitGateway tgw;

FlowLog.Builder.create(this, "TransitGatewayFlowLog")
        .resourceType(FlowLogResourceType.fromTransitGatewayId(tgw.getRef()))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
CfnTransitGateway tgw;

new FlowLog(this, "TransitGatewayFlowLog", new FlowLogProps {
    ResourceType = FlowLogResourceType.FromTransitGatewayId(tgw.Ref)
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var tgw CfnTransitGateway

ec2.NewFlowLog(this, jsii.String("TransitGatewayFlowLog"), &FlowLogProps{
	ResourceType: ec2.FlowLogResourceType_FromTransitGatewayId(tgw.ref),
})
```

## Initializer

TypeScript:

```ts
new FlowLogResourceType()
```

Python:

```python
FlowLogResourceType()
```

Java:

```java
new FlowLogResourceType()
```

C# / .NET:

```csharp
new FlowLogResourceType()
```

Golang:

```go
NewFlowLogResourceType()
```

## Properties

- `resourceId`: string — The Id of the resource that the flow log should be attached to.

- `resourceType`: string — The type of resource to attach a flow log to.

## Methods

- `fromNetworkInterfaceId(id: string): FlowLogResourceType // chainable` (static) — The Network Interface to attach the Flow Log to.

- `fromSubnet(subnet: ISubnetRef): FlowLogResourceType // chainable` (static) — The subnet to attach the Flow Log to.

- `fromTransitGatewayAttachmentId(id: string): FlowLogResourceType // chainable` (static) — The Transit Gateway Attachment to attach the Flow Log to.

- `fromTransitGatewayId(id: string): FlowLogResourceType // chainable` (static) — The Transit Gateway to attach the Flow Log to.

- `fromVpc(vpc: IVpc): FlowLogResourceType // chainable` (static) — The VPC to attach the Flow Log to.
