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
860
AWSでサーバ運用してみる
Junpei Kuriyama
November 22, 2019
Tweet
Share
Other Decks in Technology
See All in Technology
SSMRunbook作成の勘所_20241120
koichiotomo
1
100
TanStack Routerに移行するのかい しないのかい、どっちなんだい! / Are you going to migrate to TanStack Router or not? Which one is it?
kaminashi
0
530
B2B SaaS × AI機能開発 〜テナント分離のパターン解説〜 / B2B SaaS x AI function development - Explanation of tenant separation pattern
oztick139
2
210
マルチプロダクトな開発組織で 「開発生産性」に向き合うために試みたこと / Improving Multi-Product Dev Productivity
sugamasao
1
300
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
200
Making your applications cross-environment - OSCG 2024 NA
salaboy
0
180
【若手エンジニア応援LT会】ソフトウェアを学んできた私がインフラエンジニアを目指した理由
kazushi_ohata
0
140
10XにおけるData Contractの導入について: Data Contract事例共有会
10xinc
3
520
Microsoft MVPになる前、なってから/Fukuoka_Tech_Women_Community_1_baba
nina01
0
190
インフラとバックエンドとフロントエンドをくまなく調べて遅いアプリを早くした件
tubone24
1
430
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
280
The Rise of LLMOps
asei
5
1.1k
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Side Projects
sachag
452
42k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
670
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Docker and Python
trallard
40
3.1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
We Have a Design System, Now What?
morganepeng
50
7.2k
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