Kanji
・클라우드 엔지니어 / 프리랜서 ・1993년생 ・에히메현 출신 / 도쿄도 시부야구 거주 ・AWS 경력 5년 프로필 상세
목차
cfn-guard validate \ --rules ~/cis-aws-benchmark-level-1.guard \ --data ./template.yml
다음 다이어그램은 CloudFormation 템플릿으로 생성된 VPC 구성을 보여줍니다. AWS::EC2::RouteTable , AWS::EC2::Route , AWS::EC2::SubnetRouteTableAssociation , AWS::EC2::NetworkAcl , AWS::EC2::NetworkAclEntry 및 AWS::EC2::SubnetNetworkAclAssociation , 및 AWS::EC2::EIP 는 다이어그램에는 표시되지 않지만 VPC 구성에는 포함되어 있습니다.
AWS::EC2::RouteTable
AWS::EC2::Route
AWS::EC2::SubnetRouteTableAssociation
AWS::EC2::NetworkAcl
AWS::EC2::NetworkAclEntry
AWS::EC2::SubnetNetworkAclAssociation
AWS::EC2::EIP
다음 CloudFormation 템플릿은 VPC를 생성합니다.
다음 매개변수를 사용하여 VPC 구성을 사용자 정의할 수 있습니다.
DestinationVPCFlowLogBucketName : VPC 흐름 로그용 S3 버킷 이름
DestinationVPCFlowLogBucketName
EnableCloudWatchLogsVPCFlowLog : VPC 흐름 로그를 CloudWatch Logs로 보낼지 여부
EnableCloudWatchLogsVPCFlowLog
NatGatewayNum : NAT 게이트웨이 수(0, 1 또는 2)
NatGatewayNum
VPC 및 서브넷에 대한 CIDR 블록은 매핑 섹션에서 정의됩니다.디자인에 맞게 수정해주세요.
VPC 엔드포인트 및 보안 그룹은 이 템플릿에 포함되지 않습니다.
VPC는 운영 중에 거의 변경되지 않으므로 변경 수명주기가 짧은 VPC 엔드포인트와 보안 그룹을 별도의 템플릿으로 관리하는 것이 좋습니다.
AWSTemplateFormatVersion: 2010-09-09 Description: template.yml Parameters: DestinationVPCFlowLogBucketName: Type: String Default: "" EnableCloudWatchLogsVPCFlowLog: Type: String AllowedValues: - 'true' - 'false' Default: 'false' NatGatewayNum: Type: String AllowedValues: - '0' - '1' - '2' Default: '0' Conditions: CreateNatGateway: !Not [ !Equals [ !Ref NatGatewayNum, '0' ] ] UseNatGateway1: !Or [ !Equals [ !Ref NatGatewayNum, '1' ], !Equals [ !Ref NatGatewayNum, '2' ] ] UseNatGateway2: !Equals [ !Ref NatGatewayNum, '2' ] EnableVPCFlowLog: !Or [ !Not [ !Equals [ !Ref DestinationVPCFlowLogBucketName, "" ] ], !Equals [ !Ref EnableCloudWatchLogsVPCFlowLog, 'true' ] ] EnableS3VPCFlowLog: !Not [ !Equals [!Ref DestinationVPCFlowLogBucketName, "" ] ] EnableCloudWatchLogsVPCFlowLog: !Not [ !Equals [!Ref EnableCloudWatchLogsVPCFlowLog, 'false' ] ] Mappings: VPC: VPC1: CIDR: 10.0.0.0/16 Subnet: PublicSubnet1: CIDR: 10.0.0.0/20 PublicSubnet2: CIDR: 10.0.16.0/20 PrivateSubnet1: CIDR: 10.0.32.0/20 PrivateSubnet2: CIDR: 10.0.48.0/20 ProtectedSubnet1: CIDR: 10.0.64.0/22 ProtectedSubnet2: CIDR: 10.0.68.0/22 Resources: VPC1: Type: AWS::EC2::VPC Properties: CidrBlock: !FindInMap [ VPC, VPC1, CIDR ] EnableDnsSupport: true EnableDnsHostnames: true Tags: - Key: Name Value: sample-vpc InternetGateway: Type: AWS::EC2::InternetGateway Properties: Tags: - Key: Name Value: sample-igw VPCGatewayAttachment: Type: AWS::EC2::VPCGatewayAttachment Properties: VpcId: !Ref VPC1 InternetGatewayId: !Ref InternetGateway PublicSubnet1: Type: AWS::EC2::Subnet Metadata: cfn_nag: rules_to_suppress: - id: W33 reason: "This is a public subnet." Properties: VpcId: !Ref VPC1 CidrBlock: !FindInMap [ Subnet, PublicSubnet1, CIDR ] AvailabilityZone: !Select [ 0, !GetAZs '' ] MapPublicIpOnLaunch: true Tags: - Key: Name Value: sample-public1 PublicSubnet2: Type: AWS::EC2::Subnet Metadata: cfn_nag: rules_to_suppress: - id: W33 reason: "This is a public subnet." Properties: VpcId: !Ref VPC1 CidrBlock: !FindInMap [ Subnet, PublicSubnet2, CIDR ] AvailabilityZone: !Select [ 1, !GetAZs '' ] MapPublicIpOnLaunch: true Tags: - Key: Name Value: sample-public2 PrivateSubnet1: Type: AWS::EC2::Subnet Properties: VpcId: !Ref VPC1 CidrBlock: !FindInMap [ Subnet, PrivateSubnet1, CIDR ] AvailabilityZone: !Select [ 0, !GetAZs '' ] MapPublicIpOnLaunch: false Tags: - Key: Name Value: sample-private1 PrivateSubnet2: Type: AWS::EC2::Subnet Properties: VpcId: !Ref VPC1 CidrBlock: !FindInMap [ Subnet, PrivateSubnet2, CIDR ] AvailabilityZone: !Select [ 1, !GetAZs '' ] MapPublicIpOnLaunch: false Tags: - Key: Name Value: sample-private2 ProtectedSubnet1: Type: AWS::EC2::Subnet Properties: VpcId: !Ref VPC1 CidrBlock: !FindInMap [ Subnet, ProtectedSubnet1, CIDR ] AvailabilityZone: !Select [ 0, !GetAZs '' ] MapPublicIpOnLaunch: false Tags: - Key: Name Value: sample-protected1 ProtectedSubnet2: Type: AWS::EC2::Subnet Properties: VpcId: !Ref VPC1 CidrBlock: !FindInMap [ Subnet, ProtectedSubnet2, CIDR ] AvailabilityZone: !Select [ 1, !GetAZs '' ] MapPublicIpOnLaunch: false Tags: - Key: Name Value: sample-protected2 NATGateway1EIP: Type: AWS::EC2::EIP Condition: UseNatGateway1 DependsOn: VPCGatewayAttachment Properties: Domain: vpc Tags: - Key: Name Value: sample-nat-eip1 NatGateway1: Type: AWS::EC2::NatGateway Condition: UseNatGateway1 Properties: AllocationId: !GetAtt NATGateway1EIP.AllocationId SubnetId: !Ref PublicSubnet1 Tags: - Key: Name Value: sample-natgw1 NATGateway2EIP: Type: AWS::EC2::EIP Condition: UseNatGateway2 DependsOn: VPCGatewayAttachment Properties: Domain: vpc Tags: - Key: Name Value: sample-nat-eip2 NatGateway2: Type: AWS::EC2::NatGateway Condition: UseNatGateway2 Properties: AllocationId: !GetAtt NATGateway2EIP.AllocationId SubnetId: !Ref PublicSubnet2 Tags: - Key: Name Value: sample-natgw2 PublicRouteTable: Type: AWS::EC2::RouteTable Properties: VpcId: !Ref VPC1 Tags: - Key: Name Value: sample-public-rt PublicRoute: Type: AWS::EC2::Route DependsOn: VPCGatewayAttachment Properties: RouteTableId: !Ref PublicRouteTable DestinationCidrBlock: 0.0.0.0/0 GatewayId: !Ref InternetGateway PublicSubnet1RouteTableAssociation: Type: AWS::EC2::SubnetRouteTableAssociation Properties: SubnetId: !Ref PublicSubnet1 RouteTableId: !Ref PublicRouteTable PublicSubnet2RouteTableAssociation: Type: AWS::EC2::SubnetRouteTableAssociation Properties: SubnetId: !Ref PublicSubnet2 RouteTableId: !Ref PublicRouteTable PrivateSubnet1RouteTable: Type: AWS::EC2::RouteTable Condition: CreateNatGateway Properties: VpcId: !Ref VPC1 Tags: - Key: Name Value: sample-private-rt PrivateSubnet1Route: Type: AWS::EC2::Route Condition: CreateNatGateway Properties: RouteTableId: !Ref PrivateSubnet1RouteTable DestinationCidrBlock: 0.0.0.0/0 NatGatewayId: !If [ UseNatGateway1, !Ref NatGateway1, !Ref NatGateway2 ] PrivateSubnet1RouteTableAssociation: Type: AWS::EC2::SubnetRouteTableAssociation Condition: CreateNatGateway Properties: SubnetId: !Ref PrivateSubnet1 RouteTableId: !Ref PrivateSubnet1RouteTable PrivateSubnet2RouteTable: Type: AWS::EC2::RouteTable Condition: CreateNatGateway Properties: VpcId: !Ref VPC1 Tags: - Key: Name Value: sample-private-rt PrivateSubnet2Route: Type: AWS::EC2::Route Condition: CreateNatGateway Properties: RouteTableId: !Ref PrivateSubnet2RouteTable DestinationCidrBlock: 0.0.0.0/0 NatGatewayId: !If [ UseNatGateway2, !Ref NatGateway2, !Ref NatGateway1 ] PrivateSubnet2RouteTableAssociation: Type: AWS::EC2::SubnetRouteTableAssociation Condition: CreateNatGateway Properties: SubnetId: !Ref PrivateSubnet2 RouteTableId: !Ref PrivateSubnet2RouteTable ProtectedRouteTable: Type: AWS::EC2::RouteTable Properties: VpcId: !Ref VPC1 Tags: - Key: Name Value: sample-protected-rt ProtectedSubnet1RouteTableAssociation: Type: AWS::EC2::SubnetRouteTableAssociation Properties: SubnetId: !Ref ProtectedSubnet1 RouteTableId: !Ref ProtectedRouteTable ProtectedSubnet2RouteTableAssociation: Type: AWS::EC2::SubnetRouteTableAssociation Properties: SubnetId: !Ref ProtectedSubnet2 RouteTableId: !Ref ProtectedRouteTable CustomNetworkAcl: Type: AWS::EC2::NetworkAcl Properties: VpcId: !Ref VPC1 Tags: - Key: Name Value: sample-custom-nacl CustomNetworkAclEntryInbound: Type: AWS::EC2::NetworkAclEntry Metadata: cfn_nag: rules_to_suppress: - id: W66 reason: "This rule allows all inbound traffic, which is necessary for the VPC to function properly." Properties: NetworkAclId: !Ref CustomNetworkAcl RuleNumber: 100 Protocol: -1 RuleAction: allow Egress: false CidrBlock: 0.0.0.0/0 CustomNetworkAclEntryOutbound: Type: AWS::EC2::NetworkAclEntry Metadata: cfn_nag: rules_to_suppress: - id: W66 reason: "This rule allows all outbound traffic, which is necessary for the VPC to function properly." Properties: NetworkAclId: !Ref CustomNetworkAcl RuleNumber: 100 Protocol: -1 RuleAction: allow Egress: true CidrBlock: 0.0.0.0/0 NaclAssociationPublicSubnet1: Type: AWS::EC2::SubnetNetworkAclAssociation Properties: SubnetId: !Ref PublicSubnet1 NetworkAclId: !Ref CustomNetworkAcl NaclAssociationPublicSubnet2: Type: AWS::EC2::SubnetNetworkAclAssociation Properties: SubnetId: !Ref PublicSubnet2 NetworkAclId: !Ref CustomNetworkAcl NaclAssociationPrivateSubnet1: Type: AWS::EC2::SubnetNetworkAclAssociation Properties: SubnetId: !Ref PrivateSubnet1 NetworkAclId: !Ref CustomNetworkAcl NaclAssociationPrivateSubnet2: Type: AWS::EC2::SubnetNetworkAclAssociation Properties: SubnetId: !Ref PrivateSubnet2 NetworkAclId: !Ref CustomNetworkAcl NaclAssociationProtectedSubnet1: Type: AWS::EC2::SubnetNetworkAclAssociation Properties: SubnetId: !Ref ProtectedSubnet1 NetworkAclId: !Ref CustomNetworkAcl NaclAssociationProtectedSubnet2: Type: AWS::EC2::SubnetNetworkAclAssociation Properties: SubnetId: !Ref ProtectedSubnet2 NetworkAclId: !Ref CustomNetworkAcl S3FlowLog: Type: AWS::EC2::FlowLog Condition: EnableS3VPCFlowLog Properties: ResourceId: !Ref VPC1 ResourceType: VPC TrafficType: ALL LogDestinationType: s3 LogDestination: !Sub 'arn:aws:s3:::${DestinationVPCFlowLogBucketName}' Tags: - Key: Name Value: sample-vpc-s3-flow-log CloudWatchLogsFlowLog: Type: AWS::EC2::FlowLog Condition: EnableCloudWatchLogsVPCFlowLog Properties: ResourceId: !Ref VPC1 ResourceType: VPC TrafficType: ALL LogDestinationType: cloud-watch-logs LogDestination: !Sub 'arn:aws:logs:ap-northeast-1:${AWS::AccountId}:log-group:/aws/vpc/flow-logs' Tags: - Key: Name Value: sample-vpc-cloudwatch-logs-flow-log FlowLogsLogGroup: Type: AWS::Logs::LogGroup Condition: EnableCloudWatchLogsVPCFlowLog Properties: LogGroupName: /aws/vpc/flow-logs RetentionInDays: 90 Tags: - Key: Name Value: sample-vpc-flow-logs-log-group FlowLogsIAMRole: Type: AWS::IAM::Role Condition: EnableVPCFlowLog Metadata: cfn_nag: rules_to_suppress: - id: W28 reason: "IAM role name is specified as a fixed value." guard: SuppressedRules: - IAM_NO_INLINE_POLICY_CHECK Properties: RoleName: sample-flow-logs-role AssumeRolePolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Principal: Service: - vpc-flow-logs.amazonaws.com Action: - sts:AssumeRole Path: / Policies: - PolicyName: FlowLogsS3Policy PolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Action: - s3:PutObject Resource: !Sub 'arn:aws:s3:::${DestinationVPCFlowLogBucketName}/*' - PolicyName: FlowLogsCloudWatchLogsPolicy PolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Action: - logs:CreateLogGroup - logs:CreateLogStream - logs:PutLogEvents - logs:DescribeLogGroups - logs:DescribeLogStreams Resource: !Sub "arn:aws:logs:ap-northeast-1:${AWS::AccountId}:log-group:/aws/vpc/*" Outputs: VPCId: Value: !Ref VPC1 Export: Name: SampleVPCId PublicSubnet1Id: Value: !Ref PublicSubnet1 Export: Name: SamplePublicSubnet1Id PublicSubnet2Id: Value: !Ref PublicSubnet2 Export: Name: SamplePublicSubnet2Id PrivateSubnet1Id: Value: !Ref PrivateSubnet1 Export: Name: SamplePrivateSubnet1Id PrivateSubnet2Id: Value: !Ref PrivateSubnet2 Export: Name: SamplePrivateSubnet2Id ProtectedSubnet1Id: Value: !Ref ProtectedSubnet1 Export: Name: SampleProtectedSubnet1Id ProtectedSubnet2Id: Value: !Ref ProtectedSubnet2 Export: Name: SampleProtectedSubnet2Id
Amazon VPC는 AWS 클라우드 내에 가상 프라이빗 클라우드를 구축하기 위한 서비스입니다. VPC를 사용하면 AWS 클라우드 내에서 자체 네트워크를 구성할 수 있습니다. 이 ... [더 보기]
Amazon S3는 AWS 클라우드에 오브젝트 스토리지를 구축하는 서비스입니다. 저장 데이터에는 웹 사이트의 정적 콘텐츠, 백업 데이터, 아카이브 데이터 및 로그 파일이 포함됩니다 ... [더 보기]
Real-time AI quant analysis of corporate earnings reports.
실전 같은 AI 음성 모의 통화와 5축 정밀 피드백. 16강 인터랙티브 강의와 스튜디오급 AI 프로필 생성 지원.
영수증 촬영 즉시 Gemini AI가 품목과 금액을 자동 인식. 모임 및 여행 경비를 손쉽게 더치페이하고 정산합니다.
점술사, 집사, 바텐더 AI 캐릭터가 직접 게임을 진행하고 대화 주제를 던져 모임을 흥미진진하게 만듭니다.
人工甘味料や添加物のNG除外と有効成分あたりの実質単価比較データベース。