Class CfnFlowLog

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, ITaggable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-08T21:35:05.726Z") @Stability(Stable) public class CfnFlowLog extends CfnResource implements IInspectable, ITaggable
Specifies a VPC flow log that captures IP traffic for a specified network interface, subnet, or VPC.

To view the log data, use Amazon CloudWatch Logs (CloudWatch Logs) to help troubleshoot connection issues. For example, you can use a flow log to investigate why certain traffic isn't reaching an instance, which can help you diagnose overly restrictive security group rules. For more information, see VPC Flow Logs in the Amazon VPC User Guide .

Example:

 // 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.*;
 Object destinationOptions;
 CfnFlowLog cfnFlowLog = CfnFlowLog.Builder.create(this, "MyCfnFlowLog")
         .resourceId("resourceId")
         .resourceType("resourceType")
         // the properties below are optional
         .deliverCrossAccountRole("deliverCrossAccountRole")
         .deliverLogsPermissionArn("deliverLogsPermissionArn")
         .destinationOptions(destinationOptions)
         .logDestination("logDestination")
         .logDestinationType("logDestinationType")
         .logFormat("logFormat")
         .logGroupName("logGroupName")
         .maxAggregationInterval(123)
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .trafficType("trafficType")
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnFlowLog

      protected CfnFlowLog(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnFlowLog

      protected CfnFlowLog(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnFlowLog

      @Stability(Stable) public CfnFlowLog(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnFlowLogProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrId

      @Stability(Stable) @NotNull public String getAttrId()
      The ID of the flow log.

      For example, fl-123456abc123abc1 .

    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getTags

      @Stability(Stable) @NotNull public TagManager getTags()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getTags in interface ITaggable
    • getResourceId

      @Stability(Stable) @NotNull public String getResourceId()
      The ID of the resource to monitor.
    • setResourceId

      @Stability(Stable) public void setResourceId(@NotNull String value)
      The ID of the resource to monitor.
    • getResourceType

      @Stability(Stable) @NotNull public String getResourceType()
      The type of resource to monitor.
    • setResourceType

      @Stability(Stable) public void setResourceType(@NotNull String value)
      The type of resource to monitor.
    • getDeliverCrossAccountRole

      @Stability(Stable) @Nullable public String getDeliverCrossAccountRole()
      The ARN of the IAM role that allows the service to publish flow logs across accounts.
    • setDeliverCrossAccountRole

      @Stability(Stable) public void setDeliverCrossAccountRole(@Nullable String value)
      The ARN of the IAM role that allows the service to publish flow logs across accounts.
    • getDeliverLogsPermissionArn

      @Stability(Stable) @Nullable public String getDeliverLogsPermissionArn()
      The ARN of the IAM role that allows Amazon EC2 to publish flow logs to the log destination.
    • setDeliverLogsPermissionArn

      @Stability(Stable) public void setDeliverLogsPermissionArn(@Nullable String value)
      The ARN of the IAM role that allows Amazon EC2 to publish flow logs to the log destination.
    • getDestinationOptions

      @Stability(Stable) @Nullable public Object getDestinationOptions()
      The destination options.
    • setDestinationOptions

      @Stability(Stable) public void setDestinationOptions(@Nullable Object value)
      The destination options.
    • getLogDestination

      @Stability(Stable) @Nullable public String getLogDestination()
      The destination for the flow log data.

      The meaning of this parameter depends on the destination type.

    • setLogDestination

      @Stability(Stable) public void setLogDestination(@Nullable String value)
      The destination for the flow log data.

      The meaning of this parameter depends on the destination type.

    • getLogDestinationType

      @Stability(Stable) @Nullable public String getLogDestinationType()
      The type of destination for the flow log data.
    • setLogDestinationType

      @Stability(Stable) public void setLogDestinationType(@Nullable String value)
      The type of destination for the flow log data.
    • getLogFormat

      @Stability(Stable) @Nullable public String getLogFormat()
      The fields to include in the flow log record, in the order in which they should appear.
    • setLogFormat

      @Stability(Stable) public void setLogFormat(@Nullable String value)
      The fields to include in the flow log record, in the order in which they should appear.
    • getLogGroupName

      @Stability(Stable) @Nullable public String getLogGroupName()
      The name of a new or existing CloudWatch Logs log group where Amazon EC2 publishes your flow logs.
    • setLogGroupName

      @Stability(Stable) public void setLogGroupName(@Nullable String value)
      The name of a new or existing CloudWatch Logs log group where Amazon EC2 publishes your flow logs.
    • getMaxAggregationInterval

      @Stability(Stable) @Nullable public Number getMaxAggregationInterval()
      The maximum interval of time during which a flow of packets is captured and aggregated into a flow log record.
    • setMaxAggregationInterval

      @Stability(Stable) public void setMaxAggregationInterval(@Nullable Number value)
      The maximum interval of time during which a flow of packets is captured and aggregated into a flow log record.
    • getTagsRaw

      @Stability(Stable) @Nullable public List<CfnTag> getTagsRaw()
      The tags to apply to the flow logs.
    • setTagsRaw

      @Stability(Stable) public void setTagsRaw(@Nullable List<CfnTag> value)
      The tags to apply to the flow logs.
    • getTrafficType

      @Stability(Stable) @Nullable public String getTrafficType()
      The type of traffic to monitor (accepted traffic, rejected traffic, or all traffic).
    • setTrafficType

      @Stability(Stable) public void setTrafficType(@Nullable String value)
      The type of traffic to monitor (accepted traffic, rejected traffic, or all traffic).