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
B2B SaaS × AI機能開発 〜テナント分離のパターン解説〜 / B2B SaaS x AI function development - Explanation of tenant separation pattern
oztick139
2
220
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
Python(PYNQ)がテーマのAMD主催のFPGAコンテストに参加してきた
iotengineer22
0
470
TypeScript、上達の瞬間
sadnessojisan
46
13k
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
200
CysharpのOSS群から見るModern C#の現在地
neuecc
1
3.1k
開発生産性を上げながらビジネスも30倍成長させてきたチームの姿
kamina_zzz
2
1.7k
Taming you application's environments
salaboy
0
180
Application Development WG Intro at AppDeveloperCon
salaboy
0
180
Shopifyアプリ開発における Shopifyの機能活用
sonatard
4
250
ドメインの本質を掴む / Get the essence of the domain
sinsoku
2
150
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
470
Featured
See All Featured
Gamification - CAS2011
davidbonilla
80
5k
How to train your dragon (web standard)
notwaldorf
88
5.7k
How GitHub (no longer) Works
holman
310
140k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
Ruby is Unlike a Banana
tanoku
97
11k
Side Projects
sachag
452
42k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Code Reviewing Like a Champion
maltzj
520
39k
Building Your Own Lightsaber
phodgson
103
6.1k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
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