EC2 User Script
Bootstrap : lanching commands when a machine starts (기계가 시작할때 명령을 내림)
Script : 컴퓨터가 처음 시작될때만 실행하고 그다음은 실행하지 않는다.
사용자 스크랩트에 많이 추가될수록 부팅속도가 느리다
ec2 user script 는 root user를 위해 실행된다. (root user의 sudo 명령)
EC2 만들때
key pair 의 key format
- ppk ( 윈도우7,8)
- pem (Linux, Mac, Window10 등)
- User data : EC2를 실행하기전에 어떻게 실행해야하는지 뭐부터해야하는지 알려주는 곳
=> 명령들 전달
- EC2 인스턴스에 접근을 위해 public IPv4 주소 사용

- private IPv4 주소 : 비공개 AWS 네트워크의 내부적으로 인스턴스에 접근하기 위해 사용한다.
EC2 Instance 종류
Memory Optimized : 메모리에서 데이터 세팅을 처리해줌 => 여기서 메모리는 램을 말한다.
고성능 관계/비관계형 데이터 베이스
웹 스케일 캐시 보관소들을 분배함
사업 intellijgence 에 최적화된 데이타베이스
대규모 비구조적 데이터를 실시간 살핀다.
- Memory Optimized : Memory Optimized EC2 instances are great for workloads requiring large data sets of memory, but not for workloads requiring high computing capacity.
title examples : R or U or X 들어가는것
============================================================================
- Storage Optimized : 빈번하게 일어나는 온라인 거래 처리 (OLTP) 시스템
관계형 & NoSQL 데이터베이스
Storage Optimized EC2 instances are great for workloads requiring high, sequential read and write access to large data sets on local storage, but not for workloads requiring high computing capacity.
title examples : I or D or H 들어가는 것
============================================================================
General Purlpose : Great for a diversity of workloads such as web servers or code repositories (웹서버 or 코드 레파지토리
- General Purpose : General Purpose EC2 instances are great for a diversity of workloads requiring balance between compute, memory, and network, but not for workloads requiring high computing capacity.
title examples : M or T 들어감
============================================================================
Compute Optimized : 계산 집약적 작업에 최적화 되어있음, 웹 서버 고성능 컴퓨터, 머신 러닝, 게임서버
- Compute Optimized : A company would like to deploy a high-performance computing (HPC) application on EC2.
title examples : C 들어가는것
============================================================================
가속화 : P or G or Trn or Inf or DL or F or VT
Cache for in-memory
Data warehousing applications
distributed file systems
보안 그룹 (Security Group) traffic control 가능
액세를 위해 하나의 별도의 보안 그룹을 유지하는게 좋은데 SSH 접근에 대한 보안 그룹을 분리하면 좋다.
내부 트래픽은 막고 외부트래픽을 허용해야한다
All inbound traffic is blocked by default
All outbound traffic is authorised by default
부하 분산 장치
다른 보안 그룹으로 부터 보안그룹을 참조하는 방법

여기서 EC2 Instance 의 보안그룹은 Security Group1 과 2 를 허용해놓은 상태이다
하지만 허용되지 않은 Security Group3 가 들어오게 된다면 액세스가 거부된다.
어떤 클래식 포트를 알아야 하는가?
22 = SSH (Secure Shell) - log into a Linux instance
21 = FTP (File Transfer Protocol) - upload files into a file share
22 = SFTP (Secure File Transfer Protocol) - upload files using SSH
80 = HTTP - access unsecured websites
443 = HTTPS - access unsecured websites
3389 = RDP - (Remote Desktop Protocol) - log into a Windows instance
Inbound rules : 외부로부터 EC2 인스턴스로의 연결을 허용하는 규칙
Security 그룹에서 80 HTTP 을 지우고 나면 public IPv4의 주소를 사용하여 연결하여도 연결이 안된다
=> 80포트는 외부에서의 EC2인스턴스 연결을 관리함.
연결을 실패하게되면 그것은 타임아웃이라고 부른다.
SSH 타임아웃이 있고 HTTP 쿼리를 작업하려 할 때 타임아웃이 있는데 이럴때는
Security Group이 원인이기 때문에 Security Group의 inbound rules 를 확인하여 포트 설정을 추가해주면 된다.
Security Group 은 다른 인스턴스에서도 사용이 가능
Putty : SSH 프로토콜을 사용해 EC2 인스턴스에 안전하게 접속할수있다
인스턴스 자격증명
aws iam configure 명령어를 사용해 중요한 내용들을 입력하게되면 보안상 중요한 내용들을 전부 입력해주는 꼴이기 때문에 루트계정 따로 그냥쓰는 계정 따로 분리한 것은 의미가 없어진다 이때는 Instance 의 security 에 role 을 부여해주는 것이 좋은데 이때 IAM role 을 사용하여 instance에 부여해주면 된다.
- On-Demand: 시간 단위로 필요할 때만 사용하는 방식, 사전 약정 없음.
- Reserved Instances: 1년 또는 3년 약정으로 비용 절감.
- 1 year or 3 years terms are available for EC2 Reserved Instances.
- Savings Plans: 사용량에 대한 약정으로 시간당 일정 금액을 지불, 1년 또는 3년 약정.
- Spot Instances: AWS가 남는 용량을 저렴하게 제공하나, 필요시 인스턴스가 종료될 수 있음. - Which EC2 Purchasing Option can provide the biggest discount, but is not suitable for critical jobs or databases?
- Dedicated Hosts: 물리적 서버를 독점적으로 사용하는 방식.
- Capacity Reservations: 리전에 인스턴스 용량을 미리 예약, 사용 여부와 상관없이 비용 지불.
Amazon VPC IP Address Manager
IPAM을 생성하게되면 계정 내 모든 IP주소를 모니터링하고 정보를 얻을 수 있다
Shared Responsibility Model for EC2
AWS담당 : 인프라, 물리적 호스트, 하드웨어 유지보수, 회원들이 규정에 준수하는지 확인
계정주들이 할것
The customer is responsible for operating-system patches and updates on EC2 Instances, as well as data security on the instances, Security Groups rules, etc.
- 클라우드 내의 보안 책임 -> 보안그룹규칙 정의
- 모든 패치와 업데이트는 스스로 AWS는 가상머신만 제공해줌
- 인스턴스내에서 데이터가 안전한지 확인
'인프라 개념' 카테고리의 다른 글
[AWS] EBS Volume 2025 - 3 - 7 (0) | 2025.03.07 |
---|---|
하이퍼바이저 (0) | 2025.02.27 |