Slide 1

Slide 1 text

5FSSBGPSNͰαΫοͱ࡞Δ"84ωοτϫʔΫ "84ࣄۀ෦ɹࠤഢߤ

Slide 2

Slide 2 text

ࣗݾ঺հ ࠤഢߤ ɾΫϥεϝιου"84ࣄۀ෦ ɾ೥݄ೖࣾ ɾΦϖϨʔλʔˠࣾ಺4&ˠ/&ˠ"84 ɾ"84-BNCEB $PEFγϦʔζ͕޷͖ ɾ5FSSBGPSN "OTJCMF͕޷͖ ɾΞΠίϯݘ͚ͩͲຊ౰͸ೣ೿

Slide 3

Slide 3 text

5FSSBGPSNͷ࿩Λ͠·͢

Slide 4

Slide 4 text

࿩͢͜ͱ w5FSSBGPSNͱ͸ w5FSSBGPSNϞδϡʔϧ w5FSSBGPSNͰαΫοͱ"84ωοτϫʔΫߏங σϞ wνʔϜͰ࢖͏5FSSBGPSN5JQT w5FSSBGPSNͰͷӡ༻ w·ͱΊ

Slide 5

Slide 5 text

5FSSBGPSNͱ͸

Slide 6

Slide 6 text

ͬ͘͟Γݴ͏ͱΠϯϑϥߏ੒؅ཧπʔϧ

Slide 7

Slide 7 text

5FSSBGPSNͱ͸ w7BHSBOU 1BDLFS 7BVMUͳͲͰ༗໊ͳ)BTIJ$PSQۘ੡ͷπʔϧ wΠϯϑϥΛίʔυͰ؅ཧ͢Δ͜ͱ͕Ͱ͖Δ wόʔδϣϯ؅ཧγεςϜ (JUͱ͔ Ͱ؅ཧͰ͖Δ w͞·͟·ͳΫϥ΢υϓϩόΠμΛαϙʔτ wΦϑΟγϟϧ"84 "[VSF ($1 4PGU-BZFS %JHJUBM0DFBO wΧελϜϓϥάΠϯ͘͞ΒͷΫϥ΢υ wͦͷଞʹ΋͞·͟·ͳαʔϏε΍ιϑτ΢ΣΞΛαϙʔτ

Slide 8

Slide 8 text

ͳʹΑΓ΋ϝϦοτͩͱࢥͬͯΔ͜ͱ

Slide 9

Slide 9 text

υϥΠϥϯ͕Մೳ

Slide 10

Slide 10 text

ɾϦιʔεͷ࡞੒ɺ࡟আɺมߋલʹυϥΠϥϯΛ࣮ߦͰ͖Δ ɾυϥΠϥϯͰͲͷϦιʔεʹͲͷΑ͏ͳมߋ͕͋Δͷ͔֬ೝͰ͖Δ υϥΠϥϯػೳ

Slide 11

Slide 11 text

ίʔυαϯϓϧ

Slide 12

Slide 12 text

71$ resource "aws_vpc" "main-vpc" { cidr_block = "10.0.0.0/16" enable_dns_support = true enable_dns_hostnames = true tags { Name = "main-vpc" Environment = "prod" } }

Slide 13

Slide 13 text

αϒωοτ resource "aws_subnet" "frontend-1a" { vpc_id = "${aws_vpc.main.id}" cidr_block = "10.0.1.0/24" availability_zone = "ap-northeast-1a" map_public_ip_on_launch = true tags { Name = "frontend-1a-subnet" Environment = "prod" } }

Slide 14

Slide 14 text

ͳΜͱͳ͘ศརͦ͏ͳͷ఻ΘΓ·ͨ͠Ͱ͠ΐ͏͔ʂ

Slide 15

Slide 15 text

5FSSBGPSNϞδϡʔϧ

Slide 16

Slide 16 text

5FSSBGPSNϞδϡʔϧ ɾ5FSSBGPSNίʔυΛϞδϡʔϧԽͰ͖Δ ɾݺͼग़͠ݩ͔ΒύϥϝʔλʔΛ౉ͯ͠؆୯ʹϦιʔεΛ࡞੒Ͱ͖Δ ɾϩʔΧϧϑΝΠϧɺ(JU)VCͳͲͷϞδϡʔϧΛࢦఆͰ͖Δ module "vpc" source = "modules/vpc" name = "my-vpc" cidr = "10.0.0.0/16" azs = ["ap-northeast-1a", "ap-northeast-1c"] private_subnets = ["10.0.1.0/24", "10.0.2.0/24"] public_subnets = ["10.0.101.0/24", "10.0.102.0/24"] tags = { Environment = "prod" } }

Slide 17

Slide 17 text

5FSSBGPSN.PEVMF3FHJTUSZ

Slide 18

Slide 18 text

5FSSBGPSN.PEVMF3FHJTUSZ ɾ)BTIJ$PSQఏڙͷ5FSSBGPSNϞδϡʔϧϨδετϥ ɾ͞·͟·ͳϞδϡʔϧ͕ެ։͞Ε͍ͯΔ ɾ5FSSBGPSNίʔυ͔Βެ։͞Ε͍ͯΔϞδϡʔϧΛ࢖༻Ͱ͖Δ ɾϞδϡʔϧͷόʔδϣϯ؅ཧ΋αϙʔτ

Slide 19

Slide 19 text

5FSSBGPSNͰαΫοͱ"84ωοτϫʔΫߏங

Slide 20

Slide 20 text

͔͜͜ΒσϞ

Slide 21

Slide 21 text

νʔϜͰ࢖͏5FSSBGPSN5JQT

Slide 22

Slide 22 text

ϦϞʔτόοΫΤϯυ

Slide 23

Slide 23 text

ϦϞʔτόοΫΤϯυ 5FSSBGPSNͷঢ়ଶϑΝΠϧ UGTUBUF w؅ཧର৅Ϧιʔεͷ৘ใΛอ࣋͢Δঢ়ଶϑΝΠϧΛੜ੒ w*%ɺ"3/ɺύϥϝʔλʔɺλά৘ใͳͲ ՝୊ wෳ਺ਓͰ5FSSBGPSNΛ࢖͏৔߹ɺঢ়ଶϑΝΠϧͷڞ༗͕ඞਢ w"3/΍3%4ͷϚελϢʔβʔύεϫʔυ΋อଘ͞ΕΔͷͰ(JU ϦϙδτϦͳͲͰ͸؅ཧͨ͘͠ͳ͍

Slide 24

Slide 24 text

ͦ͜ͰϦϞʔτόοΫΤϯυػೳ

Slide 25

Slide 25 text

ϦϞʔτόοΫΤϯυ ղܾࡦ wϦϞʔτόοΫΤϯυ͸ঢ়ଶϑΝΠϧΛڞ༗͢ΔͨΊͷػೳ w5FSSBGPSNίʔυʹঢ়ଶϑΝΠϧͷอଘઌΛઃఆ͢Δ͜ͱ ͕Ͱ͖Δ w"84࢖ͬͯΔͳΒϦϞʔτόοΫΤϯυ͸4͕͓͢͢Ί w4͸όʔδϣχϯάػೳ΍ϥΠϑαΠΫϧػೳ͕༏ल

Slide 26

Slide 26 text

ϦϞʔτόοΫΤϯυઃఆྫ terraform { backend "s3" { bucket = "terraform-tfstate-bucket" key = "myproject/tfstate" region = "ap-northeast-1" acl = "bucket-owner-full-control" } }

Slide 27

Slide 27 text

εςʔτϩοΫ

Slide 28

Slide 28 text

εςʔτϩοΫ ՝୊ wϦϞʔτόοΫΤϯυΛઃఆ͍ͯ͠Δ৔߹ɺಉ࣌ʹQMBO΍ BQQMZΛ࣮ߦ͢Δͱঢ়ଶϑΝΠϧ͕յΕͯ͠·͏Մೳੑ͕͋Δ ղܾࡦ wεςʔτϩοΫػೳΛ࢖ͬͯQMBO΍BQQMZΛಉ࣮࣌ߦͰ͖ ͳ͍Α͏ʹ͢Δ wϦϞʔτόοΫΤϯυ͕4ͷ৔߹͸%ZOBNP%#Λ࢖ͬͯΔ

Slide 29

Slide 29 text

εςʔτϩοΫઃఆྫ terraform { backend "s3" { bucket = "terraform-tfstate-bucket" key = "myproject/tfstate" region = "ap-northeast-1" acl = "bucket-owner-full-control" dynamodb_table = "tf-statelock" } }

Slide 30

Slide 30 text

5FSSBGPSNόʔδϣϯͷݻఆ

Slide 31

Slide 31 text

5SFSSBGPSNόʔδϣϯͷݻఆ ՝୊ wνʔϜϝϯόʔͷ5FSSBGPSNόʔδϣϯ͕ҟͳΔͱόάͳͲͰϋϚͬͨΓ͢Δ w5FSSBGPSNϓϩόΠμϓϥάΠϯͷόʔδϣϯ΋ଘࡏ͢ΔͷͰ஫ҙ ղܾࡦ w5FSSBGPSNίʔυ಺Ͱ5FSSBGPSNόʔδϣϯɺ5FSSBGPSNϓϩόΠμϓϥάΠ ϯͷόʔδϣϯΛݻఆ͢Δ wUGFOWΛ࢖ͬͯ5FSSBGPSNόʔδϣϯΛ੾Γସ͑Δ wUGFOWͰσΟϨΫτϦ͝ͱʹ5FSSBGPSNόʔδϣϯΛݻఆ͢Δ UFSSBGPSN WFSTJPO࡞੒

Slide 32

Slide 32 text

5SFSSBGPSNόʔδϣϯͷݻఆ terraform { required_version = "= 0.11.7" backend "s3" { bucket = "terraform-tfstate-bucket" key = "myproject/tfstate" region = "ap-northeast-1" acl = "bucket-owner-full-control" dynamodb_table = "tf-statelock" } }

Slide 33

Slide 33 text

5SFSSBGPSNϓϩόΠμϓϥάΠϯόʔδϣϯͷݻఆ provider aws { version = "= 1.22.0" region = "ap-northeast-1" }

Slide 34

Slide 34 text

5FSSBGPSNͰͷӡ༻

Slide 35

Slide 35 text

ۓٸ࣌Ҏ֎͸جຊతʹ5FSSBGPSNͰมߋૢ࡞

Slide 36

Slide 36 text

ۓٸ࣌Ҏ֎͸جຊతʹ5FSSBGPSNͰมߋૢ࡞ wঢ়ଶϑΝΠϧͱ࣮ࡍͷϦιʔεͰࠩҟ͕ͰΔͱQMBO΍BQQMZͰҙਤ ͠ͳ͍ࠩ෼͕ͰΔ wো֐࣌ɺۓٸ࣌Ҏ֎͸5FSSBGPSNͰมߋૢ࡞͢Δ͜ͱ৺͕͚Δ wखಈͰطଘϦιʔεΛมߋͨ͠৔߹͸ɺࠩҟ͕Ͱͳ͍Α͏ʹ5FSSBGPSN ίʔυΛमਖ਼͠ɺUFSSBGPSNSFGSFTIͰঢ়ଶϑΝΠϧΛߋ৽ wखಈͰ৽نϦιʔεΛ࡞੒ͨ͠৔߹͸ɺ5FSSBGPSNίʔυΛमਖ਼ͨ͠ ্ͰɺUFSSBGPSNJNQPSUͰ࡞੒ͨ͠ϦιʔεΛঢ়ଶϑΝΠϧʹΠϯϙʔ τ

Slide 37

Slide 37 text

5FSSBGPSNͷόʔδϣϯΞοϓ

Slide 38

Slide 38 text

5FSSBGPSNͷόʔδϣϯΞοϓ w݁ߏͳස౓Ͱ৽͍͠όʔδϣϯ͕ϦϦʔε͞ΕͯΔ wӡ༻ͯ͘͠ͳ͔Ͱ৽͍͠ػೳɺط஌ͷόάमਖ਼ͳͲͰόʔδϣ ϯΞοϓͨ͘͠ͳΔ͸ͣ w(JU)VCͷ$)"/(&-0(ͱެࣜͷΞοϓάϨʔυΨΠυ͸ ಡΜͰ͓͖·͠ΐ͏

Slide 39

Slide 39 text

5FSSBGPSNϓϩόΠμϓϥάΠϯͷόʔδϣϯΞοϓ

Slide 40

Slide 40 text

5FSSBGPSNϓϩόΠμϓϥάΠϯͷόʔδϣϯΞοϓ w"84ɺ($1ɺ"[VSFͳͲͷϓϥάΠϯ΋݁ߏͳස౓Ͱ৽͠ ͍όʔδϣϯ͕ϦϦʔε͞ΕΔ wΫϥ΢υϓϩόΠμͷ৽αʔϏεɺ৽ػೳΛ࢖͓͏ͱ͢Δͱ όʔδϣϯΞοϓͨ͘͠ͳͬͯ͘Δ wͪ͜Β΋(JU)VCͷ$)"/(&-0(͸ಡΈɺόʔδϣϯΞο ϓޙʹQMBOͰࠩ෼͕ͳ͍͜ͱ͸֬ೝ͠·͠ΐ͏

Slide 41

Slide 41 text

·ͱΊ

Slide 42

Slide 42 text

·ͱΊ w5FSSBGPSN͸ΠϯϑϥΛίʔυͰ؅ཧͰ͖Δ wυϥΠϥϯΛ࣮ߦͰ͖Δ wϞδϡʔϧΛ࢖ָ͕ͬͯͰ͖Δ wνʔϜͰӡ༻ɾ؅ཧ͢ΔͨΊͷ৭ʑͳػೳ͕͋Δ w5FSSBGPSN࠷ߴ