Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
AWSネットワーク入門
Search
carotene4035
December 15, 2018
360
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
AWSネットワーク入門
AWSのネットワークについて基礎的な知識を整理しました。
carotene4035
December 15, 2018
Transcript
56 slides
AWSネットワーク入門 carotene4035 1
自己紹介 2
自己紹介 • h0ps://twi0er.com/carotene4035 • Qiitaで記事書いてます(変なやつ) – つるのおんがえしでPermission Denied.
• h0ps://qiita.com/carotene4035/items/ 2972c68027D29086378 3
本出しました 4
本出しました • 技術書典で技術書(ラノベ)を出しました • デザインパターンなのに、エモい。という本 – 「デザインパターンの本を読んだけど、理屈っぽく ていまいちよくわからなかった」人のための、
「デザインパターンを本能で理解する」本 – ラノベ調 – h0ps://carotene4035.booth.pm/items/1044161 5
いきさつ • セキュリティ強化のため、ネットワーク構成を 整理(してもらった) • 構成をAWS上でポチポチ作るのが僕の最初 の仕事 •
ぜんぜんわからん 6
いきさつ • ちょっとずつわかってきたので、完全に理解し たつもりになった • そういうのはよくないので、 今日はマサカリ大歓迎です
7
前提 • システムを構成するインフラ要素にアクセス制御をしたい ことがある – 外部からアクセスさせたいもの(ELB, webサーバなど) –
外部からアクセスさせたくないもの(RDSなど) • 見せたいものだけ見せ、見せたくないものは見せないこと により、セキュリティを向上させたい • そのための技術がAWSで使うことが出来る 8
主な技術 • VPC • Subnet • Route table
• Security group 9
VPC • Virtual Private Cloud – 外からのアクセスを制限することが出来る、 社内ネットワークをクラウド上に作れるイメージ
10
Subnet • Subnet – VPCの中を小さくいくつかに分けたもの – 各々のSubnetに通信規則を設定することが出来る
( network ACL, route table) – VPCのipアドレス帯が枯渇しない限り いくらでもたてれる – 使用するsubnetの個数と、 その上に載せたいインスタンスの個数を考えた上で ネットワーク部を決める 11
VPCとsubnetの関係 • VPCのIPレンジを10.0.0.0/16にする • 使用可能なIPレンジの中からsubnetを作る 12
subnetで使えるip • 10.0.0.0/24 で分けた場合 – 以下の5つのipについては使用不可 • 10.0.0.0:
ネットワークアドレス • 10.0.0.1: VPC ルーター用に AWS で予約 • 10.0.0.2: AWS で予約 • 10.0.0.3: 将来の利用のために AWS で予約 • 10.0.0.255: ネットワークブロードキャストアドレス • h0ps://docs.aws.amazon.com/ja_jp/vpc/latest/ userguide/VPC_Subnets.html 13
VPCとsubnetの関係 • 例 VPC 10.0.0.0/16 – Subnet1 10.0.0.0/24 – Subnet2 10.0.1.0/24
– Subnet3 10.0.2.0/24 – … – Subnet255 10.0.255.0/24 14
Route table • Route table – 各VPC, 各subnetに1つ紐付けられる
– 通信の規則を記述したもの • 例) このip範囲への通信は、ここへ飛ばす 15
Security group • Security group – インスタンスにたいして1つ以上紐つけるもの – そのインスタンスへの流入、流出を細かく制御す
ることができる(source, port, protocolが指定でき る) h0ps://docs.aws.amazon.com/ja_jp/AWSEC2/ latest/UserGuide/using-‐network-‐security.html 16
【補足】Default VPC/Subnet/RT • AWSアカウントを作ると、defaultで以下のものが作ら れる – VPC
• 172.31.0.0/16 • Igwがa0achされている – VPCに紐付くsubnet • 172.31.0.0/20, 172.31.16.0/20, 172.31.32.0/20 – Route table • igwとlocalへのルートが記述されており、 VPCとsubnetに関連付けられている 17
Default VPC/Subnet/RT • つまり、AWSアカウント開設時に存在する subnetはすべてpublic subnet(後述) 18
今回やること • システム構成図 – 第一部 • EC2に立てたインスタンスにpingを通すまで – 第二部
• EC2からprivate subnetに立てたRDSに接続するまで 19
第一部 20
VPCを作る • IPv4 CIDR 21
VPCを作る 22
Subnetを作る • VPC, AZ, CIDR 23
Subnetを作る 24
EC2インスタンスを立てる 25
外からアクセスする用にEIPを置く 26
外からアクセスする用にEIPを置く失敗 27
Elas`cIP注意 • Elas`c IPを使用するにはigwが必要 28
VPCにigwを紐つける 29
外からアクセスする用にEIPを置く 30
確認&ping通らない 31
Subnetの設定を確認 32
Route Table紐付け前 33
新しくroute tableを作って紐付け 34
Route Table紐付け後 35
補足 • igwへの通り道があるsubnetのことを、 public subnetといいます 36
確認&ping通らない 37
インスタンスのSecurity Groupを確認 38
ICMPを許可 39
ping… 40
普通に通った 41
第二部 42
private subnetを立てる • RDSは外からアクセスさせたくないので、 igwをroute tableに持たないprivate subnetを 立てる 43
44
RDSを立てる • RDSを立てるにはAZをまたいだ複数のsubnet で構成される「subnet group」を作る必要があ る • そのためにsubnetをもう一つ追加する
45
46
RDSを立てる • Subnet groupを作成 47
48
RDSを立てる • 今回は作っていないが、別のAZにレプリカを作る ことができる • 作っておくと、1つのAZがやられても大丈夫 • ※
レプリカを作らなくても、 subnet groupには必ず別AZのsubnetを含んでい なくてはならない(ややこしい) 49
50
EC2にsshでログイン&psql接続→失敗 51
RDSのセキュリティグループ編集 52
EC2にsshでログイン&psql接続→成功 53
外部から接続→失敗、つまり成功 54
55
まとめ • 割と楽しい • 設定項目が多い • その分、細かい制御が可能だということ
• VPCレベルで共通の設定→VPCのroute table • Subnetレベルで共通→Subnetのroute table, network ACL • インスタンスレベル→security group • など、どこで何を設定するのかを考える必要がある 56
More Decks by carotene4035
See All by carotene4035
GraphQLのN+1問題を解決したい
carotene4035
1
260
読者を置き去りにする技術
carotene4035
13
8.2k
Aws is emotional.
carotene4035
2
300
名称未設定.pdf
carotene4035
0
240
migrationツールについて
carotene4035
0
120
adtech history
carotene4035
0
120
ファイルアクセスに関する脆弱性
carotene4035
0
140
僕らだけのアニメを放映する
carotene4035
3
1.5k
使いやすい広告管理画面について考えてみる
carotene4035
0
75
Featured
See All Featured
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
480
Git: the NoSQL Database
bkeepers
PRO
433
67k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
48k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.4k
A better future with KSS
kneath
240
18k
The Art of Programming - Codeland 2020
erikaheidi
57
15k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.5k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
2
2.1k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
610
Building the Perfect Custom Keyboard
takai
2
970
Navigating Team Friction
lara
192
16k