CloudFormation을 사용하여 VPC 흐름 로그를 설정하고 출력 대상을 S3으로 설정
8156 단어 CloudFormationvpcVPCFlowLogsAWS
소개
이 기사에서는 AWS CloudFormation 관리 콘솔을 사용하여 VPC 플로우 로그를 설정하고 대상을 S3로 설정하는 단계를 설명합니다. (초보자용)
본 기사에서 게재하고 있는 템플릿의 최신판은 아래에 두고 있습니다.
htps : // 기주 b. 코 m / 오쿠보 t / 아 ws-c ぉ d d ぉ r 마치 온
출력 대상을 CloudWatchLogs로 설정하는 단계는 아래를 참조하십시오.
CloudFormation을 사용하여 VPC 흐름 로그 설정
구성도

전제 조건
아래의 기사의 구축 순서로, VPC를 구축하고 있는 것.
CloudFormation을 사용하여 VPC 구축
PJPrefix의 값은 동일하게 한다.
구축 절차
1 AWS CloudFormation 관리 콘솔에서 스택 생성을 클릭합니다.

2 후술하는 템플릿을 선택합니다.

3 각 파라미터를 입력합니다.

매개변수 이름
용도
비고
스택 이름
템플릿에서 만들 리소스 집합의 이름
예 prd-stack-vpc-20180801
PJPrefix
구축하는 프로젝트의 환경을 식별하기 위해서 각 컴퍼넌트의 선두에 부여하는 식별자
예 qiita-prd
필터
플로우 로그의 트래픽 타입 허가된 로그만 출력하는 경우, ACCEPT 거부된 로그만 출력하는 경우, REJECT 모든 로그를 출력하는 경우는, ALL
ALL 기본)
4 후속 작업은 기본값으로 다음으로 생성됩니다.
5 상황이 CREATE COMPLETE가 되면 VPC 플로우 로그의 설정과 플로우 로그 출력용 S3 버킷의 작성이 완료됩니다. 버킷 정책도 자동으로 설정됩니다.

6 VPC 관리 콘솔에서도 구성되어 있는지 확인할 수 있습니다.

템플릿
vpcflowlogs-s3.ymlAWSTemplateFormatVersion: "2010-09-09"
Description:
VPCFlowLogs Settings (Destination Type is S3)
Metadata:
"AWS::CloudFormation::Interface":
ParameterGroups:
- Label:
default: "Project Name Prefix"
Parameters:
- PJPrefix
- Label:
default: "VPCFlowLogs Configuration (Destination Type is S3)"
Parameters:
- Filter
# ------------------------------------------------------------#
# Input Parameters
# ------------------------------------------------------------#
Parameters:
PJPrefix:
Type: String
Filter:
Type: String
Default: ALL
AllowedValues: [ ALL, ACCEPT, REJECT ]
Resources:
# ------------------------------------------------------------#
# S3 Bucket for VPCFlowLogs
# ------------------------------------------------------------#
#FlowLogsBucket
FlowLogsBucket:
Type: "AWS::S3::Bucket"
Properties:
BucketName: !Sub "${PJPrefix}-vpcflowlogs"
# ------------------------------------------------------------#
# VPCFlowLogs
# ------------------------------------------------------------#
VPCFlowLogs:
Type: "AWS::EC2::FlowLog"
DependsOn: FlowLogsBucket
Properties:
LogDestination: !Sub "arn:aws:s3:::${FlowLogsBucket}"
LogDestinationType: s3
ResourceId: { "Fn::ImportValue": !Sub "${PJPrefix}-vpc" }
ResourceType: "VPC"
TrafficType: !Ref Filter
# ------------------------------------------------------------#
# Output Parameters
# ------------------------------------------------------------#
Outputs:
#FlowLogsBucket
FlowLogsBucket:
Value: !Ref FlowLogsBucket
Export:
Name: !Sub "${PJPrefix}-vpcflowlogs"
Reference
이 문제에 관하여(CloudFormation을 사용하여 VPC 흐름 로그를 설정하고 출력 대상을 S3으로 설정), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/okubot55/items/fbb1ae40bd8104958102
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)

전제 조건
아래의 기사의 구축 순서로, VPC를 구축하고 있는 것.
CloudFormation을 사용하여 VPC 구축
PJPrefix의 값은 동일하게 한다.
구축 절차
1 AWS CloudFormation 관리 콘솔에서 스택 생성을 클릭합니다.

2 후술하는 템플릿을 선택합니다.

3 각 파라미터를 입력합니다.

매개변수 이름
용도
비고
스택 이름
템플릿에서 만들 리소스 집합의 이름
예 prd-stack-vpc-20180801
PJPrefix
구축하는 프로젝트의 환경을 식별하기 위해서 각 컴퍼넌트의 선두에 부여하는 식별자
예 qiita-prd
필터
플로우 로그의 트래픽 타입 허가된 로그만 출력하는 경우, ACCEPT 거부된 로그만 출력하는 경우, REJECT 모든 로그를 출력하는 경우는, ALL
ALL 기본)
4 후속 작업은 기본값으로 다음으로 생성됩니다.
5 상황이 CREATE COMPLETE가 되면 VPC 플로우 로그의 설정과 플로우 로그 출력용 S3 버킷의 작성이 완료됩니다. 버킷 정책도 자동으로 설정됩니다.

6 VPC 관리 콘솔에서도 구성되어 있는지 확인할 수 있습니다.

템플릿
vpcflowlogs-s3.ymlAWSTemplateFormatVersion: "2010-09-09"
Description:
VPCFlowLogs Settings (Destination Type is S3)
Metadata:
"AWS::CloudFormation::Interface":
ParameterGroups:
- Label:
default: "Project Name Prefix"
Parameters:
- PJPrefix
- Label:
default: "VPCFlowLogs Configuration (Destination Type is S3)"
Parameters:
- Filter
# ------------------------------------------------------------#
# Input Parameters
# ------------------------------------------------------------#
Parameters:
PJPrefix:
Type: String
Filter:
Type: String
Default: ALL
AllowedValues: [ ALL, ACCEPT, REJECT ]
Resources:
# ------------------------------------------------------------#
# S3 Bucket for VPCFlowLogs
# ------------------------------------------------------------#
#FlowLogsBucket
FlowLogsBucket:
Type: "AWS::S3::Bucket"
Properties:
BucketName: !Sub "${PJPrefix}-vpcflowlogs"
# ------------------------------------------------------------#
# VPCFlowLogs
# ------------------------------------------------------------#
VPCFlowLogs:
Type: "AWS::EC2::FlowLog"
DependsOn: FlowLogsBucket
Properties:
LogDestination: !Sub "arn:aws:s3:::${FlowLogsBucket}"
LogDestinationType: s3
ResourceId: { "Fn::ImportValue": !Sub "${PJPrefix}-vpc" }
ResourceType: "VPC"
TrafficType: !Ref Filter
# ------------------------------------------------------------#
# Output Parameters
# ------------------------------------------------------------#
Outputs:
#FlowLogsBucket
FlowLogsBucket:
Value: !Ref FlowLogsBucket
Export:
Name: !Sub "${PJPrefix}-vpcflowlogs"
Reference
이 문제에 관하여(CloudFormation을 사용하여 VPC 흐름 로그를 설정하고 출력 대상을 S3으로 설정), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/okubot55/items/fbb1ae40bd8104958102
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
1 AWS CloudFormation 관리 콘솔에서 스택 생성을 클릭합니다.

2 후술하는 템플릿을 선택합니다.

3 각 파라미터를 입력합니다.

매개변수 이름
용도
비고
스택 이름
템플릿에서 만들 리소스 집합의 이름
예 prd-stack-vpc-20180801
PJPrefix
구축하는 프로젝트의 환경을 식별하기 위해서 각 컴퍼넌트의 선두에 부여하는 식별자
예 qiita-prd
필터
플로우 로그의 트래픽 타입 허가된 로그만 출력하는 경우, ACCEPT 거부된 로그만 출력하는 경우, REJECT 모든 로그를 출력하는 경우는, ALL
ALL 기본)
4 후속 작업은 기본값으로 다음으로 생성됩니다.
5 상황이 CREATE COMPLETE가 되면 VPC 플로우 로그의 설정과 플로우 로그 출력용 S3 버킷의 작성이 완료됩니다. 버킷 정책도 자동으로 설정됩니다.

6 VPC 관리 콘솔에서도 구성되어 있는지 확인할 수 있습니다.

템플릿
vpcflowlogs-s3.ymlAWSTemplateFormatVersion: "2010-09-09"
Description:
VPCFlowLogs Settings (Destination Type is S3)
Metadata:
"AWS::CloudFormation::Interface":
ParameterGroups:
- Label:
default: "Project Name Prefix"
Parameters:
- PJPrefix
- Label:
default: "VPCFlowLogs Configuration (Destination Type is S3)"
Parameters:
- Filter
# ------------------------------------------------------------#
# Input Parameters
# ------------------------------------------------------------#
Parameters:
PJPrefix:
Type: String
Filter:
Type: String
Default: ALL
AllowedValues: [ ALL, ACCEPT, REJECT ]
Resources:
# ------------------------------------------------------------#
# S3 Bucket for VPCFlowLogs
# ------------------------------------------------------------#
#FlowLogsBucket
FlowLogsBucket:
Type: "AWS::S3::Bucket"
Properties:
BucketName: !Sub "${PJPrefix}-vpcflowlogs"
# ------------------------------------------------------------#
# VPCFlowLogs
# ------------------------------------------------------------#
VPCFlowLogs:
Type: "AWS::EC2::FlowLog"
DependsOn: FlowLogsBucket
Properties:
LogDestination: !Sub "arn:aws:s3:::${FlowLogsBucket}"
LogDestinationType: s3
ResourceId: { "Fn::ImportValue": !Sub "${PJPrefix}-vpc" }
ResourceType: "VPC"
TrafficType: !Ref Filter
# ------------------------------------------------------------#
# Output Parameters
# ------------------------------------------------------------#
Outputs:
#FlowLogsBucket
FlowLogsBucket:
Value: !Ref FlowLogsBucket
Export:
Name: !Sub "${PJPrefix}-vpcflowlogs"
Reference
이 문제에 관하여(CloudFormation을 사용하여 VPC 흐름 로그를 설정하고 출력 대상을 S3으로 설정), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/okubot55/items/fbb1ae40bd8104958102
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
AWSTemplateFormatVersion: "2010-09-09"
Description:
VPCFlowLogs Settings (Destination Type is S3)
Metadata:
"AWS::CloudFormation::Interface":
ParameterGroups:
- Label:
default: "Project Name Prefix"
Parameters:
- PJPrefix
- Label:
default: "VPCFlowLogs Configuration (Destination Type is S3)"
Parameters:
- Filter
# ------------------------------------------------------------#
# Input Parameters
# ------------------------------------------------------------#
Parameters:
PJPrefix:
Type: String
Filter:
Type: String
Default: ALL
AllowedValues: [ ALL, ACCEPT, REJECT ]
Resources:
# ------------------------------------------------------------#
# S3 Bucket for VPCFlowLogs
# ------------------------------------------------------------#
#FlowLogsBucket
FlowLogsBucket:
Type: "AWS::S3::Bucket"
Properties:
BucketName: !Sub "${PJPrefix}-vpcflowlogs"
# ------------------------------------------------------------#
# VPCFlowLogs
# ------------------------------------------------------------#
VPCFlowLogs:
Type: "AWS::EC2::FlowLog"
DependsOn: FlowLogsBucket
Properties:
LogDestination: !Sub "arn:aws:s3:::${FlowLogsBucket}"
LogDestinationType: s3
ResourceId: { "Fn::ImportValue": !Sub "${PJPrefix}-vpc" }
ResourceType: "VPC"
TrafficType: !Ref Filter
# ------------------------------------------------------------#
# Output Parameters
# ------------------------------------------------------------#
Outputs:
#FlowLogsBucket
FlowLogsBucket:
Value: !Ref FlowLogsBucket
Export:
Name: !Sub "${PJPrefix}-vpcflowlogs"
Reference
이 문제에 관하여(CloudFormation을 사용하여 VPC 흐름 로그를 설정하고 출력 대상을 S3으로 설정), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/okubot55/items/fbb1ae40bd8104958102텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)