create_flow_logs
async
¶
create_flow_logs(
*,
config_overrides: Optional[AsyncEC2ClientConfig] = None,
dry_run: Optional[Boolean] = None,
client_token: Optional[String] = None,
deliver_logs_permission_arn: Optional[String] = None,
deliver_cross_account_role: Optional[String] = None,
log_group_name: Optional[String] = None,
resource_ids: Optional[FlowLogResourceIds] = None,
resource_type: Optional[FlowLogsResourceType] = None,
traffic_type: Optional[TrafficType] = None,
log_destination_type: Optional[LogDestinationType] = None,
log_destination: Optional[String] = None,
log_format: Optional[String] = None,
tag_specifications: Optional[TagSpecificationList] = None,
max_aggregation_interval: Optional[Integer] = None,
destination_options: Optional[DestinationOptionsRequest] = None,
tag_field_specifications: Optional[TagFieldSpecificationListRequest] = None,
) -> CreateFlowLogsResult
Creates one or more flow logs to capture information about IP traffic for a specific network interface, subnet, or VPC.
Flow log data for a monitored network interface is recorded as flow log records, which are log events consisting of fields that describe the traffic flow. For more information, see Flow log records in the Amazon VPC User Guide.
When publishing to CloudWatch Logs, flow log records are published to a log group, and each network interface has a unique log stream in the log group. When publishing to Amazon S3, flow log records for all of the monitored network interfaces are published to a single log file object that is stored in the specified bucket.
For more information, see VPC Flow Logs in the Amazon VPC User Guide.
Parameters:
-
dry_run(Optional[Boolean], default:None) –Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation. -
client_token(Optional[String], default:None) –Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see How to ensure idempotency.
-
deliver_logs_permission_arn(Optional[String], default:None) –The ARN of the IAM role that allows Amazon EC2 to publish flow logs to the log destination.
This parameter is required if the destination type is
cloud-watch-logs, or if the destination type iskinesis-data-firehoseand the delivery stream and the resources to monitor are in different accounts. -
deliver_cross_account_role(Optional[String], default:None) –The ARN of the IAM role that allows Amazon EC2 to publish flow logs across accounts.
-
log_group_name(Optional[String], default:None) –The name of a new or existing CloudWatch Logs log group where Amazon EC2 publishes your flow logs.
This parameter is valid only if the destination type is
cloud-watch-logs. -
resource_ids(Optional[FlowLogResourceIds], default:None) –The IDs of the resources to monitor. For example, if the resource type is
VPC, specify the IDs of the VPCs.Constraints: Maximum of 25 for transit gateway resource types. Maximum of 300 for the other resource types.
-
resource_type(Optional[FlowLogsResourceType], default:None) –The type of resource to monitor.
-
traffic_type(Optional[TrafficType], default:None) –The type of traffic to monitor (accepted traffic, rejected traffic, or all traffic). This parameter is not supported for transit gateway resource types. It is required for the other resource types.
-
log_destination_type(Optional[LogDestinationType], default:None) –The type of destination for the flow log data.
Default:
cloud-watch-logs -
log_destination(Optional[String], default:None) –The destination for the flow log data. The meaning of this parameter depends on the destination type.
-
If the destination type is
cloud-watch-logs, specify the ARN of a CloudWatch Logs log group. For example:arn:aws:logs:region:account_id:log-group:my_group
Alternatively, use the
LogGroupNameparameter. -
If the destination type is
s3, specify the ARN of an S3 bucket. For example:arn:aws:s3:::my_bucket/my_subfolder/
The subfolder is optional. Note that you can't use
AWSLogsas a subfolder name. -
If the destination type is
kinesis-data-firehose, specify the ARN of a Kinesis Data Firehose delivery stream. For example:arn:aws:firehose:region:account_id:deliverystream:my_stream
-
-
log_format(Optional[String], default:None) –The fields to include in the flow log record. List the fields in the order in which they should appear. If you omit this parameter, the flow log is created using the default format. If you specify this parameter, you must include at least one field. For more information about the available fields, see Flow log records in the Amazon VPC User Guide or Transit Gateway Flow Log records in the Amazon Web Services Transit Gateway Guide.
Specify the fields using the
${field-id}format, separated by spaces. -
tag_specifications(Optional[TagSpecificationList], default:None) –The tags to apply to the flow logs.
-
max_aggregation_interval(Optional[Integer], default:None) –The maximum interval of time during which a flow of packets is captured and aggregated into a flow log record. The possible values are 60 seconds (1 minute) or 600 seconds (10 minutes). This parameter must be 60 seconds for transit gateway resource types.
When a network interface is attached to a Nitro-based instance, the aggregation interval is always 60 seconds or less, regardless of the value that you specify.
Default: 600
-
destination_options(Optional[DestinationOptionsRequest], default:None) –The destination options.
-
tag_field_specifications(Optional[TagFieldSpecificationListRequest], default:None) –The tag configuration associated with the Flow Logs Amazon EC2 Tags feature fields in your custom log format.
Raises:
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_ec2/_services/async_ec2.py
8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 | |