Upgrade to Pro — share decks privately, control downloads, hide ads and more …

制約のあるAZの利用でハマった話

 制約のあるAZの利用でハマった話

2021/07/01(木)に行われた【JAWS-UG 初心者支部#38 AWSビギナーのためのLT大会!】にて発表した
「制約のあるAZの利用でハマった話」
の資料です。

Takafumi Omuro

July 01, 2021
Tweet

More Decks by Takafumi Omuro

Other Decks in Technology

Transcript

  1. ΞϕΠϥϏϦςΟκʔϯ "; "WBJMBCJMJUZ;POFT ͷ͓͞Β͍ IUUQTEPDTBXTBNB[PODPNKB@KQ"84&$MBUFTU6TFS(VJEFVTJOHSFHJPOTBWBJMBCJMJUZ[POFTIUNMΑΓҾ༻ ΞϕΠϥϏϦςΟʔκʔϯ͸ɺϦʔδϣϯίʔυͱͦΕʹଓ͘ จࣈࣝผࢠʹΑͬͯද͞Ε·͢ VTFBTUBͳͲ ɻϦιʔε ͕Ϧʔδϣϯͷෳ਺ͷΞϕΠϥϏϦςΟʔκʔϯʹ෼ࢄ͞ΕΔ

    Α͏ʹ͢ΔͨΊʹɺΞϕΠϥϏϦςΟʔκʔϯ͸֤"84ΞΧ ΢ϯτͷ໊લʹݸผʹϚοϐϯά͞Ε·͢ɻྫ͑͹ɺ"84Ξ Χ΢ϯτͷΞϕΠϥϏϦςΟʔκʔϯVTFBTUBͷ৔ॴ͸ɺ ผͷ"84ΞΧ΢ϯτͷVTFBTUBͷ৔ॴͱҟͳΔՄೳੑ͕ ͋Γ·͢ɻ
  2. ΞϕΠϥϏϦςΟκʔϯ "; "WBJMBCJMJUZ;POFT ͷ͓͞Β͍ IUUQTEPDTBXTBNB[PODPNKB@KQ"84&$MBUFTU6TFS(VJEFVTJOHSFHJPOTBWBJMBCJMJUZ[POFTIUNMΑΓҾ༻ ΞϕΠϥϏϦςΟʔκʔϯ͸ɺϦʔδϣϯίʔυͱͦΕʹଓ͘ จࣈࣝผࢠʹΑͬͯද͞Ε·͢ VTFBTUBͳͲ ɻϦιʔε ͕Ϧʔδϣϯͷෳ਺ͷΞϕΠϥϏϦςΟʔκʔϯʹ෼ࢄ͞ΕΔ

    Α͏ʹ͢ΔͨΊʹɺΞϕΠϥϏϦςΟʔκʔϯ͸֤"84ΞΧ ΢ϯτͷ໊લʹݸผʹϚοϐϯά͞Ε·͢ɻྫ͑͹ɺ"84Ξ Χ΢ϯτͷΞϕΠϥϏϦςΟʔκʔϯVTFBTUBͷ৔ॴ͸ɺ ผͷ"84ΞΧ΢ϯτͷVTFBTUBͷ৔ॴͱҟͳΔՄೳੑ͕ ͋Γ·͢ɻ
  3. $ aws ec2 describe-availability-zones \ > --region ap-northeast-1 \ >

    --query 'AvailabilityZones[].{ZoneName:ZoneName, ZoneId:ZoneId}' \ > --output table ---------------------------------- | DescribeAvailabilityZones | +------------+-------------------+ | ZoneId | ZoneName | +------------+-------------------+ | apne1-az4 | ap-northeast-1a | | apne1-az1 | ap-northeast-1c | | apne1-az2 | ap-northeast-1d | +------------+-------------------+ $-*Ͱͷ֬ೝํ๏ Ϣʔβʔ͝ͱʹϚοϐϯά͕ҧ͏ ௨ৗར༻͢Δ";/BNF ࿦ཧ໊ ར༻͍ͯ͠ΔΞΧ΢ϯτͷ";ͷ֬ೝ
  4. $ aws ec2 describe-availability-zones \ > --region ap-northeast-1 \ >

    --query 'AvailabilityZones[].{ZoneName:ZoneName, ZoneId:ZoneId}' \ > --output table ---------------------------------- | DescribeAvailabilityZones | +------------+-------------------+ | ZoneId | ZoneName | +------------+-------------------+ | apne1-az4 | ap-northeast-1a | | apne1-az1 | ap-northeast-1c | | apne1-az2 | ap-northeast-1d | +------------+-------------------+ $-*Ͱͷ֬ೝํ๏ ͜Ε͕Ұ؏ੑͷ͋Δ ࣝผࢠͰ͋Δ";*% ෺ཧ*% ར༻͍ͯ͠ΔΞΧ΢ϯτͷ";ͷ֬ೝ
  5. $ aws ec2 describe-availability-zones \ > --region ap-northeast-1 \ >

    --query 'AvailabilityZones[].{ZoneName:ZoneName, ZoneId:ZoneId}' \ > --output table ---------------------------------- | DescribeAvailabilityZones | +------------+-------------------+ | ZoneId | ZoneName | +------------+-------------------+ | apne1-az4 | ap-northeast-1a | | apne1-az1 | ap-northeast-1c | | apne1-az2 | ap-northeast-1d | +------------+-------------------+ $-*Ͱͷ֬ೝํ๏ BQOFB[͕ ଘࡏ͍ͯ͠ͳ͍ʂ ར༻͍ͯ͠ΔΞΧ΢ϯτͷ";ͷ֬ೝ
  6. ੍໿ͷ͋Δ";͕͋Δ ੍໿ͷ͋ΔΞϕΠϥϏϦςΟκʔϯʁ w ެࣜυΩϡϝϯτʹৄࡉͷهࡌ͸ͳͦ͞͏ w ੍໿ͷ͋ΔΞϕΠϥϏϦςΟκʔϯ͕͋Δͱ͍͏ ৘ใͷΈଘࡏ w ݹ͍"84Ͱ͸༗ޮԽ͞Ε͍ͯΔ͜ͱ΋͋Δ w

    71$͕ͳ͔ͬͨ࣌୅͙Β͍ݹ͍ΞΧ΢ϯτʁ w ৽͍͠"84Ͱ͸༗ޮԽ͞Ε͍ͯͳ͍ w ֘౰";*%BQOFB[͸ར༻Ͱ͖ͳ͍ جຊతʹ͸ؾʹ͠ͳͯ͘΋ ໰୊͸ͳ͍
  7. AWSTemplateFormatVersion: 2010-09-09 Parameters: AvairabilityZone1: Description: Availability Zone 1 Type: AWS::EC2::AvailabilityZone::Name

    … Resources: # Vpc Vpc: Type: AWS::EC2::VPC … # サブネット Subnet1: Type: AWS::EC2::Subnet Properties: VpcId: !Ref Vpc AvailabilityZone: !Ref AvairabilityZone1 CidrBlock: !Sub … 71$࡞੒༻$'OςϯϓϨʔτͷ࢖͍ճ͠ ࣄނͨ͠έʔε ੍໿ͷ͋Δ";Λ ҙਤͤͣબ୒ ੍໿ͷ͋Δ";Ͱ αϒωοτΛ࡞੒
  8. … 続き # NAT ゲートウェイ EIP: Type: AWS::EC2::EIP Properties: Domain:

    vpc Tags: - Key: Name Value: Nat Gateway 1 NatGateway1: Type: AWS::EC2::NatGateway Properties: AllocationId: !GetAtt EIP.AllocationId SubnetId: !Ref Subnet1 … 71$࡞੒༻$'OςϯϓϨʔτͷ࢖͍ճ͠ ࣄނͨ͠έʔε ੍໿ͷ͋Δ";Ͱ /"5Λ࡞੒
  9. … 続き # NAT ゲートウェイ EIP: Type: AWS::EC2::EIP Properties: Domain:

    vpc Tags: - Key: Name Value: Nat Gateway 1 NatGateway1: Type: AWS::EC2::NatGateway Properties: AllocationId: !GetAtt EIP.AllocationId SubnetId: !Ref Subnet1 … 71$࡞੒༻$'OςϯϓϨʔτͷ࢖͍ճ͠ ࣄނͨ͠έʔε /"5ͷ࡞੒ʹࣦഊ
  10. AWSTemplateFormatVersion: 2010-09-09 … Resources: # DB サブネットグループ DBSubnetGroup: Type: AWS::RDS::DBSubnetGroup

    Properties: DBSubnetGroupName: db-subnet-group-name SubnetIds: - Fn::ImportValue: private-subnet-1-id - Fn::ImportValue: private-subnet-2-id - Fn::ImportValue: private-subnet-3-id … 3%4࡞੒༻$'OςϯϓϨʔτͷ࢖͍ճ͠ ࣄނͨ͠έʔε ઌఔ࡞ͬͨ71$Λ ಡΈࠐΜͰɺ ੍໿ͷ͋Δ";Ͱ %#αϒωοτάϧʔϓ Λ࡞੒
  11. AWSTemplateFormatVersion: 2010-09-09 … Resources: # DB サブネットグループ DBSubnetGroup: Type: AWS::RDS::DBSubnetGroup

    Properties: DBSubnetGroupName: db-subnet-group-name SubnetIds: - Fn::ImportValue: private-subnet-1-id - Fn::ImportValue: private-subnet-2-id - Fn::ImportValue: private-subnet-3-id … 3%4࡞੒༻$'OςϯϓϨʔτͷ࢖͍ճ͠ ࣄނͨ͠έʔε ࡞੒ʹࣦഊ BQOPSUIFBTUC  BQOPSUIFBTUD  BQOPSUIFBTUE  Ͱ࡞੒͠Ζ
  12. AWSTemplateFormatVersion: 2010-09-09 … Resources: # DB サブネットグループ DBSubnetGroup: Type: AWS::RDS::DBSubnetGroup

    Properties: DBSubnetGroupName: db-subnet-group-name SubnetIds: - Fn::ImportValue: private-subnet-1-id - Fn::ImportValue: private-subnet-2-id - Fn::ImportValue: private-subnet-3-id … 3%4࡞੒༻$'OςϯϓϨʔτͷ࢖͍ճ͠ ࣄނͨ͠έʔε ࡞੒ʹࣦഊ BQOPSUIFBTUC  BQOPSUIFBTUD  BQOPSUIFBTUE  Ͱ࡞੒͠Ζ ଞʹ΋Ϧιʔε࡞ͬͨ͠ 71$͔Β΍Γ௚ͨ͘͠ͳ͍ ΜͰ͚͢Ͳʜ