本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
使用 產生 CloudFormation 範本 AWS CLI
在第一個流量日誌傳遞至 S3 儲存貯體後,您可以產生並使用 CloudFormation 範本來與 Athena 整合。
使用下列 get-flow-logs-integration-template
aws ec2 get-flow-logs-integration-template --cli-input-json file://config.json
以下是 config.json
檔案的範例。
{ "FlowLogId": "fl-12345678901234567", "ConfigDeliveryS3DestinationArn": "arn:aws:s3:::my-flow-logs-athena-integration/templates/", "IntegrateServices": { "AthenaIntegrations": [ { "IntegrationResultS3DestinationArn": "arn:aws:s3:::my-flow-logs-analysis/athena-query-results/", "PartitionLoadFrequency": "monthly", "PartitionStartDate": "2021-01-01T00:00:00", "PartitionEndDate": "2021-12-31T00:00:00" } ] } }
使用下列 create-stack
aws cloudformation create-stack --stack-name my-vpc-flow-logs --template-body file://my-cloudformation-template.json