Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
AWSでサーバ運用してみる
Search
Junpei Kuriyama
November 22, 2019
Technology
0
970
AWSでサーバ運用してみる
Junpei Kuriyama
November 22, 2019
Tweet
Share
Other Decks in Technology
See All in Technology
人を動かすことについて考える
ichimichi
2
330
あなたの知らない OneDrive
murachiakira
0
240
ZOZOTOWNフロントエンドにおけるディレクトリの分割戦略
zozotech
PRO
18
5.5k
夢の印税生活 / Life on Royalties
tmtms
0
290
そのコンポーネント、サーバー?クライアント?App Router開発のモヤモヤを可視化する補助輪
makotot
4
630
新卒(ほぼ)専業Kagglerという選択肢
nocchi1
1
2.4k
実践アプリケーション設計 ③ドメイン駆動設計
recruitengineers
PRO
7
700
AIとTDDによるNext.js「隙間ツール」開発の実践
makotot
6
720
JavaScript 研修
recruitengineers
PRO
4
400
Goss: New Production-Ready Go Binding for Faiss #coefl_go_jp
bengo4com
0
1.1k
新規案件の立ち上げ専門チームから見たAI駆動開発の始め方
shuyakinjo
0
140
Goでマークダウンの独自記法を実装する
lag129
0
220
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Into the Great Unknown - MozCon
thekraken
40
2k
Java REST API Framework Comparison - PWX 2021
mraible
33
8.8k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.6k
Why You Should Never Use an ORM
jnunemaker
PRO
59
9.5k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
1k
Building Applications with DynamoDB
mza
96
6.6k
Optimizing for Happiness
mojombo
379
70k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Transcript
AWSͰαʔόӡ༻Λͯ͠ΈΔ ۚۀେֶ ใֶՊ ܀ࢁ७ฏ JAWS –UG ۚ | 2019 KANAZAWA
• Name: ܀ࢁ ७ฏ • Belong: ۚۀେֶ • Twitter: @_Iruk_
• Skill: Ruby, Elixir, TypeScript, Go, • CLIπʔϧWebΞϓϦέʔγϣϯΛΜͰ࡞Γ·͢ɻ • Πϯϑϥ৯Θͣݏ͍ͳٕज़ͩͬͨɻ $ whoami
None
App
None
App
App
App
App
App
App
App
App
αʔόߏஙɺਏ͔ͬͨɻ
• ܦݧͷͳ͍ྖҬΛCLIͰߦ͏ͷ݁ߏਏ͍ɻ
• ܦݧͷͳ͍ྖҬΛCLIͰߦ͏ͷ݁ߏਏ͍ɻ • αʔόߏஙʹ͓͚Δࣝ࠷ݶ͋Δ
• ܦݧͷͳ͍ྖҬΛCLIͰߦ͏ͷ݁ߏਏ͍ɻ • αʔόߏஙʹ͓͚Δࣝ࠷ݶ͋Δ • ͜ͷਏ͞ΛऔΓআ͍ͯ͘ΕΔαʔϏε….
• ܦݧͷͳ͍ྖҬΛCLIͰߦ͏ͷ݁ߏਏ͍ɻ • αʔόߏஙʹ͓͚Δࣝ࠷ݶ͋Δ • ͜ͷਏ͞ΛऔΓআ͍ͯ͘ΕΔαʔϏε…. ʂ
AWSͰαʔόӡ༻Λͯ͠ΈΔ ۚۀେֶ ใֶՊ ܀ࢁ७ฏ JAWS –UG ۚ | 2019 KANAZAWA
ʮAWSͷαʔόӡ༻Λͯ͠ΈΔʯ • ӡ༻͍ͯͨ͠όοΫΤϯυͷΠϯϑϥΛAWSʹҠͨ͠ɻ • ݴޠ: Ruby • RDB: MySQL
None
Internet gateway Amazon EC2
Internet gateway Amazon RDS Amazon EC2
Internet gateway Amazon RDS Amazon S3 Amazon EC2 Amazon RDS
Amazon EC2
Internet gateway Amazon RDS Amazon S3 Amazon EC2 Amazon RDS
Amazon EC2 ΞϕΠϥϏϦςΟκʔϯ - B ΞϕΠϥϏϦςΟκʔϯ - C
ʮAWSͷαʔόӡ༻Λͯ͠ΈΔʯ • ӡ༻͍ͯͨ͠όοΫΤϯυͷΠϯϑϥΛAWSʹҠͨ͠ɻ • ಉ࣌ʹߏஙʹੑΛ࣋ͨͤͨɻ
ʮAWSͷαʔόӡ༻Λͯ͠ΈΔʯ • ӡ༻͍ͯͨ͠όοΫΤϯυͷΠϯϑϥΛAWSʹҠͨ͠ɻ • ಉ࣌ʹߏஙʹੑΛ࣋ͨͤͨɻ • => ͦͷࡍͷৄࡉɺݟΛ͍͖ͯ͠·͢ɻ
EC2ΠϯελϯεΛ࡞͢Δ Amazon EC2
Ϧʔδϣϯ
Ϧʔδϣϯ • αʔόͷཧతॴࡏҐஔ
Ϧʔδϣϯ • αʔόͷཧతॴࡏҐஔ • ຊϢʔβ͕ଟ͍αʔϏεΛӡӦ͢ΔͳΒɺϢʔβͱͷ ཧతڑ͕͍ۙ౦ژϦʔδϣϯ͕·͍͠
Ϧʔδϣϯ • αʔόͷཧతॴࡏҐஔ • ຊϢʔβ͕ଟ͍αʔϏεΛӡӦ͢ΔͳΒɺϢʔβͱͷ ཧతڑ͕͍ۙ౦ژϦʔδϣϯ͕·͍͠ • ଞͷϦʔδϣϯͷใදࣔ͞Εͳ͍ͷͰҙ (ex. όʔδχΞ෦Λબ͍ͯ͠Δͱ౦ژͷใݟ͑ͳ͍
EC2ΠϯελϯεΛ࡞͢Δ
EC2ΠϯελϯεΛ࡞͢Δ • Amazon Elastic Compute • ΠϯελϯεͱݺͿαʔόΛ࡞͢Δ • εϖοΫʹؔͯ͠બՄೳ •
OS(AMI)બՄೳ
AMIͷબ
ΠϯελϯελΠϓͷબ
ΠϯελϯελΠϓͷબ Amazon EC2 ΠϯελϯελΠϓ - https://aws.amazon.com/jp/ec2/instance-types/
VPCͷઃఆΛ͢Δ Amazon EC2 AZ(ΞϕΠϥϏϦςΟκʔϯ)
Πϯελϯεৄࡉͷઃఆ
Amazon VPCͷઃఆ
Amazon VPCͱ • CIDRϒϩοΫͷઃఆ • ΞϕΠϥϏϦςΟκʔϯͷઃఆ • AZ͕ҧ͏ͱσʔληϯλʔࣗମҧ͏ͷͰɺ ہॴతͳࡂͳͲʹඋ͑ͨߏ͕࡞ΕΔ
αϒωοτͷ࡞
EC2ΠϯελϯεΛ࡞͢Δ
EC2ΠϯελϯεΛ࡞͢Δ
ηΩϡϦςΟάϧʔϓ • ϑΝΠΞΥʔϧͷઃఆͷΑ͏ͳͷ • ࠓճ ssh: 22 http: 80 https:
443 pumaͷsocket: 3000 Λ։͚͓ͯ͘
࡞ʂ
EC2Πϯελϯεͷ • άϩʔόϧIPͱήʔτΣΠͷ४උ͞Εͨαʔό͕
EC2Πϯελϯεͷ • άϩʔόϧIPͱήʔτΣΠͷ४උ͞Εͨαʔό͕ • ηΩϡϦςΟάϧʔϓͰsshͷϙʔτΛ։͚ͨͷͰ ssh ec2-user@IPv4public -i key.pem ͰsshͰ͖Δ
•
EC2Πϯελϯεͷ • άϩʔόϧIPͱήʔτΣΠͷ४උ͞Εͨαʔό͕ • ηΩϡϦςΟάϧʔϓͰsshͷϙʔτΛ։͚ͨͷͰ ssh ec2-user@public -i key.pem ͰsshͰ͖Δ
• ϙʔτΛ։͚ͨαʔό͕͍ͯ͠ΔͷͰ MySQLͳͲϛυϧΣΞΛೖΕͯΞϓϦӡ༻͕Մೳ
EC2Πϯελϯεͷ Internet gateway Amazon EC2
࣮ࡍʹڍಈΛݟΔ • Ruby, RailsपΓͷڥߏஙΛ͢Δ
࣮ࡍʹڍಈΛݟΔ • Ruby, RailsपΓͷڥߏஙΛ͢Δ (DockerFileΛ༻ҙͯ͋͠ΔͷͰͦͷ··ίϯςφΛ࡞
࣮ࡍʹڍಈΛݟΔ • Ruby, RailsपΓͷڥߏஙΛ͢Δ (DockerFileΛ༻ҙͯ͋͠ΔͷͰͦͷ··ίϯςφΛ࡞ • ΞΫηε͕དྷͨࡍͷϑΥϫʔσΟϯάʹnginxΛॻ͘ • puma(rubyͷwebαʔό)ͷsocketΛnginxʹରԠͤ͞Δɻ
VQTUSFBNQVNB\ TFSWFSVOJYIPNFFDVTFS&$EFQUNQTPDLFUTQVNBTPDL ^ TFSWFS\ MJTUFO TFSWFS@OBNFBEESFTT JODMVEFFUDOHJOYEFGBVMUE DPOG
MPDBUJPO\ QSPYZ@TFU@IFBEFS9'PSXBSEFE'PSQSPYZ@BEE@Y@GPSXBSEFE@GPS QSPYZ@SFEJSFDUPGG QSPYZ@QBTTIUUQQVNB ^ FSSPS@QBHFIUNM MPDBUJPOYIUNM\ ^ FSSPS@QBHFYIUNM MPDBUJPOYIUNM\ ^ ^
࣮ࡍʹڍಈΛݟΔ
Internet gateway Amazon RDS Amazon EC2
RDBʹ͍ͭͯ
RDBʹ͍ͭͯ • EC2ΠϯελϯεʹRDB(MySQL, PostgreSQL) ΛೖΕΔ • Amazon RDSΛ͏
RDBʹ͍ͭͯ • EC2ΠϯελϯεʹRDB(MySQL, PostgreSQL) ΛೖΕΔ • Amazon RDSΛ͏
• Amazon Relational Database Servise • RDBʹ͍ͭͯ
• Amazon Relational Database Servise • DBͷόοΫΞοϓ੬ऑੑʹର͢ΔରԠͳͲ ΛAmazonͷαʔϏεʹҰͰ͖Δ • Τϯδϯ(RDBͷछྨ)બՄೳ
RDBʹ͍ͭͯ
RDSΠϯελϯεͷ࡞
RDSΠϯελϯεͷ࡞
ηΩϡϦςΟάϧʔϓͷઃఆ
config/database.ymlʹهड़ socket: /var/lib/mysql/mysql.sock ɹ host: address.rds.amazonaws.comɹ database: appname_developmentɹ
Internet gateway Amazon RDS Amazon EC2
ಉ͡ߏͷΠϯελϯεΛཱͯΔ
·ͱΊ • ܦݧͷগͳ͍ٕज़ऀઢͰ GUIϕʔεͰαʔόΛߏஙͰ͖Δ • අ༻͔͔ΔͷͷɺAmazonͷαʔϏεʹ ґଘ͢Δ͜ͱͰීஈཧͷ͍͠ྖҬΛҕ Ͱ͖Δ • Πϯϑϥ͕ਏ͍ਓʹͦͥ͜ͻ৮ͬͯཉ͍͠ɻ
None
AWSͰαʔόӡ༻Λͯ͠ΈΔ ۚۀେֶ ใֶՊ ܀ࢁ७ฏ JAWS –UG ۚ | 2019 KANAZAWA