첫 번째 흐름 로그가 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