PROGRAMING/BACKEND DEV

AWS SAA-C02 - S3(AWS Storage)

o_deok 2021. 7. 3. 14:57

 

0. S3 서비스란?

- secure, durable, highly-scalable 한 저장공간(storage)을 제공하는 서비스
- 데이터를 조회하고 저장하는 웹서비스 인터페이스를 쉽게 제공(웹서비스 url를 호출하면 데이터 적재/조회, 인터넷 스토리지 서비스)
- Object(as files) based storage / file은 0Byte에서 5TB size / 저장공간에 제한은 없음


0.1 bucket

- file이 저장되는 단위

- S3에 데이터를 업로드하기 위해선 AWS 리전에 S3버킷 생성 필요

- 버킷 이름은 전역 수준에서 고유하기에 같은 이름의 버킷을 생성할 수 없다.

- 버킷 생성 시엔, 지연 시간을 최적화 하고 비용을 최소화하기 위해 지리적으로 가까운 AWS리전을 선택한다.

- restricting bucket access
* bucket policies: applies across the whole bucket (버켓 단위로 접근 권한 설정)
* object policies: applies to individual files (객체_파일 단위로 접근 권한 설정)
* IAM policies to Users & Groups: applies to Users and Groups (유저 및 그룹 단위로 접근 권한 설정)


0.2 Object Based Storage

- Key: name of the object (object 이름)
- Value: data made up of a sequence of bytes (일련의 바이트로 구성된 데이터)
- Version ID: 버전관리를 위한 version ID
- Metadata: data about data (저장하려는 데이터에 대한 상세 설명)
- Subresources(하위 리소스): Access Control Lists(ACL, 객체에 대한 엑세스 제어에 활용), Torrent etc..

 

1. S3의 특징

1.1 Consistency(일관성)

- read after write consistency for PUTS of new objects (새로운 object를 쓰고 읽을 때의 일관성 유지)
- Eventual Consistency for overwrite PUTS and DELETES(can take some time to propogate)
- If you write a NEW file and read it immediately afterwards, you will be able to view that data
- If you UPDATE an EXISTING file or delete a file and read it immediately, you may get the older version, or you may not. Basically changes to objects can take a little bit of time to propagate.
- 새로운 오브젝트(파일)를 쓰고 읽을 때는 즉시 데이터를 볼 수 있음.
- 기존의 오브젝트(파일)를 수정하고 읽을 때는 전파(Propagate)로 인한 delay때문에 이전 버전을 못 읽어올 수도 있다.
- S3는 동시 작성자에 대한 객체 잠금을 지원하지 않기 때문에 동시에 같은 키에 대한 PUT요청을 실행할 경우 타임스탬프가 최신인 요청이 우선 적용된다.
- 버킷에서 버전 관리를 처음 활성화하면 변경 사항이 전파되는데 시간이 걸릴 수 있어, 버전 관리 활성화 후 15분정도의 대기 텀을 주는 것이 좋다.

 

1.2 S3의 특징, Guarantees(Durability 내구성)

- 99.999999999%의 내구성 (아주 드문 확률로 손실이 있을 수 있으나 매우매우 적은 확률)
- 99.99% availibility

 

1.3 S3의 특징, Encryption

- S3는 웹서비스 기반의 스토리지 서비스이기에 전송 시의 암호화가 필요하다.

- Excryption in Transit in achieved by SSL/TLS
- Encryption at Rest (Server Side) is achieved by S3 Manged Keys(SSE-S3), AWS key Management Service(SSE-KMS), Server Side Encryption with customer provided keys(SSE-C)

 

1.4 S3의 특징, Versioning

- 객체에 대한 모든 버전들을 관리

- stores all versions of an object (including all writes and even if you delete an object)
- provide great backup tool
- once enabled, versioning cannot be disabled, only suspended.
- Integrates with Lifecycle rules
- versioning's MFA delete capability, which uses multi factor authentication, can be used to provide an additional layer of security.

 

1.5 이외의 특징 정리 (다음 포스팅에서 추가적으로 다룰 예정)

- Tiered Storage Available(계층형 저장 가능)
- Lifecycle Management
- Versioning
- Encryption(암호화)
- MFA Delete (삭제시 MFA인증)
- Secure your data using Access Control Lists and Bucket Policies

 

2. S3 서비스 종류

 

2.1 요금

- S3 Standard: 범용 스토리지로 대개 자주 액세스하는 데이터들에 적합 (0.021~0.023USD)
- S3 Standard IA: 라이브 상태가 된지 오래되었으나 밀리초 단위 액세스 성능이 요규되는 자주 액세스하지 않는 데이터에 적합 (0.0125USD)
- S3 Intelligent - Tiering: 액세스 패턴을 알 수 없거나 액세스 패턴이 변경되는 데이터에 대해 비용 절감(자주 사용하지 않는 엑세스는 비용 절감, 객체별 모니터링 필요 시 요금 부과, S3 Standard + S3 Standard IA)
- S3 One Zone IA: 자주 액세스하지 않으나, 밀리초 단위 액세스 성능 요구 + 고가용성 및 복원력 불필요  (0.01USD)
- S3 Glacier: 검색 옵션이 1분부터 12시간까지인 장기적인 백업 및 아카이브용 (0.004USD)
- S3 Glacier Deep Archive: 일년에 한두번 액세스하고 12시간 이내에 복원가능한 장기적인 데이터 아카이브용 (0.00099USD)


S3 Glacier Deep Archive < S3 Glacier < S3 One Zone IA < S3 Standard IA < S3 Intelligent < S3 Standard

 

3. 요금 부과 기준(Charge)

- Storage
- Requests
- Storage Management Pricing
- Data Transfer Pricing
- Transfer Acceleration
enables fast, easy, and secure tranfers of files over long distances between your end users and an S3 bucket. (시스템 유저와 S3 스토리지 사이의 거리가 멀더라도 빠르고 쉽고 안정적인 파일 전송 가능하게 하는 서비스, global한 edge location으로 가능)
- Cross Region Replication Pricing
- 저장용량, 데이터 조회 및 저장 요청 수, 데이터 전송 부스터(?) 및 복제 등

 

실제 S3에 저장된 데이터를 end user근처의 edge location을 활용해 빠르게 제공할 수 있도록 한다.
다양한 상황(고가용성)을 고려해 다른 region에 bucket을 백업/복제 하는 서비스

 

4. 정리

- S3 is Object-based.
- Files can be from 0 Bytes to 5TB and there is unlimited storage.
- Files are stored in Buckets.
- S3 is a universal namespace and if you want to store or retreive some datas then you can call this URL.
- Not suitable to install an OS on.
- Successful uploads will generate a HTTP 200 status code.
- You can turn on MFA delete.