AWS EC2(2) - 아키텍트
1. Private vs Public IP (IPv4)
- Networking has two sorts of IPs. IPv4 and IPv6
- IPv4: 1.160.10.240
- IPv6: 3ffe:1900:4545:3:200:f8ff:fe21:67cf
- In this course, we will only be using IPv4. (해당 코스에서는 IPv4만 사용)
- IPv4 is still the most common format used online. (IPv4는 가장 공용으로 사용 포맷임)
IPv6 is newer and solves problems for the Internet of Things (IoT).
⇒ IPv6은 새로운 포맷이고 IoT 사용에 더 적합하다
- IPv4 allows for 3.7 billion different addresses in the public space ⇒ IPv4는 약 3억 7천정도의 다양한 address 할당이 가능하다
- IPv4: [0-255].[0-255].[0-255].[0-255].
2. Private vs PublicIP (IPv4) 차이점
- Public IP
Public IP means the machine can be identified on the internet (WWW)
⇒ 공용 IP는 인터넷에서 식별되는 기기별 주소이다
Must be unique across the whole web (not two machines can have the same public IP)
⇒ 웹 전체를 통틀어서 고유의 값으로써 하나만 갖는다
Can be geo-located easily
⇒ 위치정보를 쉽게 얻음
- Private IP
Private IP means the machine can only be identified on a private network only
⇒ 사설 IP는 사설망 내에서 식별되는 기기 주소이다
The IP must be unique across the private network
⇒ 오직 사설망 내에서 고유값을 가진다
BUT two different private networks (two companies) can have the same IPs.
⇒ 그러나 2개의 다른 사설망으로인해 같은 IP를 가질수 있다
Machines connect to WWW using a NAT + internet gateway (a proxy)
⇒ 기기는 NAT + 인터넷 게이트웨이를 이용하여 인터넷 접속이 가능하다
Only a specified range of IPs can be used as private IP
⇒ 오로지 private IP에서 사용되는 범위내에서 IP가 할당된다
3. Elastic IPs
When you stop and then start an EC2 instance, it can change its public IP.
⇒ 만약 EC2 인스턴스를 재시작하게되면, public IP가 변경된다
If you need to have a fixed public IP for your instance, you need an Elastic IP
⇒ 만약 public IP를 고정하고 싶다면, Elastic IP를 사용하면 된다
An Elastic IP is a public IPv4 IP you own as long as you don’t delete it
⇒ Elastic IP는 사용자가 지우지 않는 한, 사용자가 소유한 public IP라 할 수 있다
You can attach it to one instance at a time
⇒ 한 인스턴스에 한번에 한번 할당 가능하다
4. Elastic IP
With an Elastic IP address, you can mask the failure of an instance or software by rapidly remapping the address to another instance in your account.
⇒ Elastic IP주소가 있다면, 주소를 계정 내의 다른 인스턴스로 신속하게 다시 매핑함으로써, 인스턴스나 소프트웨어의 오류를 방지할 수 있다.
You can only have 5 Elastic IP in your account (you can ask AWS to increase that).
⇒ 계정 당 5개의 Elastic IP를 가질 수 있다 (AWS에 문의해서 늘릴 수도 있다)
Overall, try to avoid using Elastic IP (Elastic IP사용을 하지 않으려면)
They often reflect poor architectural decisions
⇒ 사용자들은 자주 잘못된 아키텍쳐구조 결정을 반영한다
Instead, use a random public IP and register a DNS name to it
⇒ 대신, random한 publicIP를 사용하도록하고, 그에 대한 DNS이름을 등록한다
Or, as we’ll see later, use a Load Balancer and don’t use a public IP
⇒ 또는, 로드 밸런서를 사용하고 public IP의 사용을 하지 않도록 한다
5. Placement Groups (배치 그룹)
Sometimes you want control over the EC2 Instance placement strategy
⇒ 사용자가 EC2 인스턴스를 배치그룹으로 묶어 사용하고 싶을 때가 있다
That strategy can be defined using placement groups
⇒ 이 때, Placement Group을 사용하면 된다
When you create a placement group, you specify one of the following strategies for the group:
1) Cluster
2) Spread
3) Partition
Cluster : clusters instances into a low-latency group in a single Availability Zone
⇒ 클러스터 : 단일 AZ내에서 저지연 인스턴스
- 장점 : Great network (10 Gbps bandwidth between instances with Enhanced Networking enabled - recommended) ⇒ 네트워크 성능 극대화
- 단점 : If the rack fails, all instances fails at the same time ⇒ 랙이 고장나면, 모든 인스턴스들까지 동시 고장
- Use case (사용 예):
Big Data job that needs to complete fast
⇒ 빅데이터 잡 돌릴때 사용
Application that needs extremely low latency and high network throughput
⇒ 저지연 고가의 네트워크 성능의 어플리케이션을 돌리고 싶을 때
Spread : spreads instances across underlying hardware (max 7 instances per group per AZ)
⇒ 스프레드 : 데이터 소실 및 서비스 실패와 같은 위험을 감소시키기 위해 다수의 AZ를 사용하고, 서로 다른 하드웨어 랙에 인스턴스를 분산 배치 (AZ당 최대 7개의 인스턴스 배치 가능)
- 장점:
Can span across Availability Zones (AZ)
⇒ AZ를 넘어선 확장 가능
Reduced risk is simultaneous failure
⇒ 감소된 리스크는 failure와 동시에 작동
EC2 Instances are on different physical hardware
⇒ EC2 인스턴스는 다른 물리적 하드웨어에 위치
- 단점:
Limited to 7 instances per AZ per placement group
⇒ placement 그룹당 AZ 하나당 7개의 인스턴스로 제한됨
- Use case:
Application that needs to maximize high availability
⇒ 최대의 고가용성이 필요할 때 사용하는 앱
Critical Applications where each instance must be isolated from failure from each other
⇒ failure로 부터 반드시 분리되어져야하는 어플리케이션을 돌릴
- 장점:
Partition : spreads instances across many different partitions (which rely on different sets of racks) within an AZ. Scales to 100s of EC2 instances per group (Hadoop, Cassandra, Kafka)
⇒ 파티션 : 인스턴스를 논리적 파티션으로 분산하여, 한 파티션에 있는 인스턴스 그룹이 다른 파티션의 인스턴스 그룹과 기본 하드웨어를 공유하지 않게 합니다. (그룹 당 100개의 EC2 인스턴스까지 스케일 증대 가능)
일반적으로 Hadoop, Cassandra, Kafka 등 대규모의 분산 및 복제된 워크로드에 필요로 합니다.
Up to 7 partitions per AZ
⇒ AZ당 최대 7개의 파티션 가능
Can span across multiple AZs in the same region
⇒ 같은 region 내에서 다수의 AZ를 넘어선 확장 가능
Up to 100s of EC2 instances
⇒ EC2 인스턴스 100개까지 증설 가능
The instances in a partition do not share racks with the instances in the other partitions
⇒ 파티션내의 인스턴스는 다른 파티션내에서 인스턴스가 포함된 랙을 공유하지 않음
A partition failure can affect many EC2 but won’t affect other partitions
⇒ 파티션 하나의 failure는 많은 EC2에 영향을 주지만, 다른 파티션에 영향은 없다
EC2 instances get access to the partition information as metadata
⇒ EC2 인스턴스는 메타데이터로서의 파티션 정보에 접근 가능하다
Use cases: HDFS, HBase, Cassandra, Kafka
### 6. Elastic Network Interfaces (ENI)
Logical component in a VPC that represents a virtual network card
⇒ VPC 내에서의 로직적 컴포넌트
- The ENI can have the following attributes:
Primary private IPv4, one or more secondary IPv4
⇒ 가장 주가 되는 IPv4와, 하나 이상의 secondary IPv4
One Elastic IP (IPv4) per private IPv4
⇒ private IPv4 하나당 하나의 Elastic IP
One Public IPv4
⇒ 한 개의 Public IPv4
One or more security groups
⇒ 한개 이상의 security groups
A MAC address
⇒ MAC 주소
You can create ENI independently and attach them on the fly (move them) on EC2 instances for failover
⇒ ENI를 독립적으로 생성 가능하고, 해당 ENI를 failover를 위한 EC2인스턴스에 attach 가능
Bound to a specific availability zone (AZ)
⇒ 특정 AZ에 바운딩 가능
### 7. EC2 Hibernate (EC2 최대 절전모드)
- We know we can stop, terminate instances
Stop – the data on disk (EBS) is kept intact in the next start
⇒ EBS내의 데이터들이 다음 boot때까지 내용을 들고 있음
Terminate – any EBS volumes (root) also set-up to be destroyed is lost ⇒ 모든 EBS내에서 저장된 내용들이 모두 파기됨
- On start, the following happens:
First start: the OS boots & the EC2 User Data script is run
⇒ 첫 부팅시, OS가 부팅되고 EC2 유저 데이터 스크립트가 작동
Following starts: the OS boots up
⇒ 두번째 이상 부팅 시에는 OS가 부팅됨
Then your application starts, caches get warmed up, and that can take time!
⇒ applcation이 시작되면, 캐시가 작동되고, 이 작업들이 시간을 잡아먹는다
- Introducing EC2 Hibernate:
The in-memory (RAM) state is preserved
⇒ RAM에 저장된 내용이 보존된다
The instance boot is much faster! (the OS is not stopped / restarted)
⇒ 인스턴스 부팅속도가 빨라진다
Under the hood: the RAM state is written to a file in the root EBS volume
⇒ RAM의 상태가 root EBS 볼륨에 기록되어진다
The root EBS volume must be encrypted
⇒ root EBS 볼륨은 반드시 암호화 되어져야한다
- Use cases:
- Long-running processing : 장기간 작동되는 프로세싱에 사용
- Saving the RAM state : RAM 상태 저장에 사용
- Services that take time to initialize : 초기화에 시간이 걸리는 서비스
### 8. EC2 Hibernate – Good to know (알아두면 좋을 것들)
- Supported Instance Families – C3, C4, C5, I3, M3, M4, R3, R4, T2, T3, …
Instance RAM Size – must be less than 150 GB.
⇒ 인스턴스 RAM 사이즈는 반드시 150GB 이하여야 한다
Instance Size – not supported for bare metal instances.
⇒ 인스턴스 사이즈는 베어메탈 인스턴스에 대해서는 지원불가
AMI – Amazon Linux 2, Linux AMI, Ubuntu, RHEL, CentOS & Windows…
⇒ AMI : 아마존 리눅스2, 리눅스 AMI, 우분투, RHEL 등
Root Volume – must be EBS, encrypted, not instance store, and large
⇒ Root 볼륨 : 암호화된 EBS여야 하고, 인스턴스 store가 아니며 커야한다
Available for On-Demand, Reserved and Spot Instances
⇒ 온디맨드, Reversed 인스턴스, Spot 인스턴스에서 가능
An instance can NOT be hibernated more than 60 days
⇒ 60일 이상에 대해서는 인스턴스 절전모드 불가