- background
- Instance Type
- SSH를 통한 machine 접근법 1 - command prompt
- SSH를 통한 machine 접근법 2 - AWS Instance Connet
여기 정리하는 내용들은 Udemy 강의를 통해 배운 내용들을 정리하였습니다.
출처 - Udemy AWS Certified Developer Associate 2022 - New!
아마존의 가장 대표적인 서비스들 중 하나인 Amazon EC2에 대해서 정리해보려 합니다.
background
Amazon Elastic Compute Cloud 에서 따온 이름인데, C가 2개 있어서 EC2 일까요?
어쩃든 EC2를 사용하게 되면 주로 EBS, ELB, ASG를 엮어서 사용하게 됩니다. (EBS,ELB,ASG는 후에 따로 포스팅해보려합니다.)
EC2에서 고려해야하는 Configuration은 다음과 같다.
OS, CPU, RAM, 저장공간, 네트워크, Firewall rules, Bootstrap.
Bootstrap은 인스턴스가 처음 시작할때 한번만 실행되는 script다.
Instance Type
예시 e.g.
c5.xlarge
c - instance class
5 - generation
xlarge - size
- General Purpose(범용성)
- 다양한 workloads에 좋습니다. (e.g. web servers, code repositories)
- Compute, Memory, Networking에 밸런스가 좋다.
- 컴퓨팅 최적화(Compute Optimized)
- 높은 성능의 컴퓨팅 작업이 필요할 떄 좋습니다.
-(e.g. Batch processing workloads, Media transcoding, High performance web servers,Scientific modeling like machin learning, Dedicated gaming servers)
- 높은 성능의 컴퓨팅 작업이 필요할 떄 좋습니다.
- 메모리 최적화(Memory Optimized)
- Large data sets in
memory에 좋습니다.- relational/non-relational databases
- web scale cache stores
- In-memory databases optimized for BI
- Applications performing real-time processing of big unstructured data
- Large data sets in
-
-1 가속화된 컴퓨팅(Accelerated Computing)
- 스토리지 최적화(Storage Optimized)
- high, sequential read and write access to large data sets on local storage에 좋습니다.
- Online transaction processing systems
- Relational/NoSQL databases
- Cache for in-memory databases like Redis
- Data warehousing applications
- Distributed file systems.
- high, sequential read and write access to large data sets on local storage에 좋습니다.
Security Group
기본적인 Networking Security 서비스로서 EC2 Instance에 들어오거나 나가는 Traffic을 제어하는 역할을 합니다.
특징을 좀 살펴보면
- Allow Rule만 가지고 있습니다.
- Port, IP range를 통해서 작동합니다.
- One(Security Group)-Many(Instance)에 부여될 수 있습니다.
- Time out 이슈와 연관있다.
- default로
Inbound traffic - block하고Outbound traffic - authorized한다.
Port 종류
22 = SSH/SFTP
21 = FTP
80 = HTTP
443 = HTTPS
3389 = RDP(Window instance)
SSH
우리로 하여금 remote machine을 제어할 수 있도록 해준다.
SSH를 통한 machine 접근법 1 - command prompt
EC2 Instance를 만들때 Key Pair(RSA)를 다운받습니다. (확장자 pem)
EC2 Instance의 Public IPv4 DNS를 복사합니다. (ec2-x-xx-xxx-xx.region-name에서도 확인할 수 있습니다.)
chmod 0400 (파일이름).pem 을 통해서 pem파일에 permission을 줍니다.
ssh -i (파일이름).pem ec2-user@x.xx.xxx.xx
SSH를 통한 machine 접근법 2 - AWS Instance Connet
AWS Console > EC2 > Instances > click a instance > Connect button > type user name > click Connect button
접근법 1에서 햇던 chmod, ssh 같은 명령어 입력 없이 끝난다.
Purchasing Options
- On-Demand Instances - 짧은/un-interrupted workload와 예상가능한 pricing에 적합하다.
- Reserved - 1년/3년 options, long workload에 적합하다.
- Spot instance - 짧은 workload, 싸다(Most cost-efficient),
butinstance를 잃을 수 있다.(less reliable) - Dedicated Hosts - Entire physical server가 필요할 때 적합하다.
- Dedicated Instances - 다른 고객과 공유되지 않는다.