Lec 04-2: Using Amazon EC2

2023. 10. 15. 18:20· CS/클라우드컴퓨팅
목차
  1. 7 Steps to launching an EC2 Instance
  2. 1. Instance name and tags
  3. 2. Choosing an Amazon Machine Image (AMI)
  4. 3. Instance type
  5. 4. Key pair
  6. 5. Network settings
  7. 6. Configure storage
  8. 7. Advanced details
  9. Configuration Considerations

7 Steps to launching an EC2 Instance

1. Instance name and tags

Tag

  • Tag is a label that you can assign to an AWS resource
  • key - value(optional), Name of the instance is the default tag
  • tag limit per EC2 resource is 50 tags
  • can search resources by key or by value or by combination of keys and values

Benefits of Using Tags

  • Resource organization: search & filter by tag, create groups of resources
  • Cost management: AWS Cost Explorer
  • Automation: automation activity script
  • Access control: IAM - attribute-based-control, IAM policies

2. Choosing an Amazon Machine Image (AMI)

Amazone Machine Image(AMI)

  • Templates for the root volume of the instance contain: OS, application servers, applications
  • Can use the same AMI to launch multiple instances that should have the same configuration
  • After an instace is created, you cannot change the AMI

Where Do You Get an AMI?

  • Pre-built
  • AWS Marketplace: digital catalog
  • Create your own
  • Community AMIs: not vetted by AWS

Benefits of AMI

  • Repeatability: Instances from same AMI are exact replicas of one another
  • Reusability: AMI packages the full configuration and content of an EC2 instance
  • Recoverability: replacing failed machines
  • Marketplace Solutions: probably an AMI that you need exists on the marketplace
  • Backups: great way to back up a complete EC2 instance configuration

3. Instance type

Instance Types

  • Instance type determines:
    • Processing power(CPU), Memory(RAM), Disk space and disk type, Network performance

Instance Families -> details on Lec 03

  • Prefix
  • Suffix
  • Levels (size of the instance)

Scailing Instances Vertically

  • Instance type can be changed after the instance is launched -> Vertically scaling is possible.
  • Vertical scailing
    • Scale up or down for CPU
    • Swtich to any instance type in any instance family.

4. Key pair

Key pair

  • At instance launch, you can specify existing key pair, create a new key pair, or not to use a key pair
  • Key pair cannot be added to the instance after it is launched
  • Key pair consists of a public key that AWS stores and the private key file that user stores.

Connecting to Your Instance with Key pair

  • Windows AMIs: Remote Desktop Protocol (RDP)
  • Linux AMIs: Secure Shell(SSH), PuTTY - need to convert .em to .ppk using PuTTYgen
  • You should never expose your private key to public

5. Network settings

  • You can choose VPC, subnet, and security group and must decide whether you will enable or disable a public IP address for the instance

Regions

  • Region is assumed based on the region that you are working in on your AWS Management Console.

VPCs and Subnets

  • When start using Amazon VPC, you have a default VPC in each AWS Region
    • default VPC comes with a public subnet in each Availability Zone of the Region
    • therefore, you can immediately start launching EC2 into a default VPC
    • You can create more public subnets in your default VPC
  • You can create and customize additional VPCs in any Region

Public IP address

  • Used to communicate btw your instances and the Internet.
  • Default VPC - Default subnet
    • By default, auto-assign public IP setting is set to enabled when you launch an instance
  • Default VPC - Custom public subnet, Custom VPC - Custom subnet
    • By default, auto-assign public IP setting is set to disabled

Security Groups

  • Virtual firewall for you instances
  • Controls network access
  • Exists outside the instance's guest OS
  • Specifies allow rules but not deny rules
  • Can be modified at any time and updates affect in real time

Security Groups Rule Components

  • Type (ex. SSH, HTTP, HTTPS)
  • Protocol (ex. TCP, UDP, ICMP)
  • Port range: verify the ports that are allowed to pass traffic for each protocol type
  • Source: the traffic can reach your instance based on a range of IP addresses

Inbound Rules and Outbound Rules

  • Inbound Rule: control traffics coming into your instance
    • it has no inbound rules by default
  • Outbound Rule: control traffics going out from your instance
    • allows all outbound traffic by default
  • Stateful Attributes
    • For every inbound rule, an outboud response is allowed by vice versa
    • If there is only one inboud rule that allows HTTP protocol from a IP 0.0.0.0/0, then a response from the instance is automatically allowed. However, since no outbound rules are specified in the security group, the instance cannot initiate an outbound call.

Managing Security Groups

  • Security groups act at the instance level, not the subnet level.
  • Can attach more than one security group to an instance

6. Configure storage

Amazon Elastic Block Store(EBS)

    • EBS can be used to run a database, host applications, and handle storage operations

 

EBS Volume Types

    • General purpose (SSD-based)
    • Provisioned IOPS (SSD-based)
      • highest-performance SSD volumes for low-latency or high-throughput workloads
    • Throughput Optimized (HDD-based)
      • low-cost HDD volume, cannot be a boot(root) volume (= cannot install OS)
    • Cold (HDD-vased)
      • lowest cost HDD volume designed for less frequently accessed workloads, cannot be a boot volume.
Speed : SSD > HDD / Cost: SSD < HDD (low)

 

Amazon EBS Storage Configuration Options

  • Volume types
    • HDD-based type cannot be the root volume
    • Can add additional volumes (non-root volumes) to your instance and different type is okay.
  • Volume Size : the size of the volume is chosen in GB
  • Delete on termination
    • whether the volume should be automatically deleted when the instance is terminated
  • Encryption
    • Using AWS Key Management Service keys to encrypt volumes

Adding a File System - Amazon Elastic File System(EFS)

  • EFS is a file system that you can use to share files among multiple EC2 instances.
    • Can attach instances to the EFS as you launch your instance or afterwards
    • Can remove instaces from EFS without losing any files stored on EFS
  • Cannot act as a root volume - each instance must have its own root volume

Amazon EC2 Instance Store

  • Instance store provides temporary block-level storage for your instance
  • Storage is located on disks that are physically attached to the host computer
    • ideal for buffers, caches, scratch data, and other temporary content
  • Instance store cannot be a root volume
  • Limitations
    • You will lose all of your data when instance is stopped, hibernated, or terminated
    • After instance launching, you cannot add instance store volumes
    • AWS does not offer you the option to detach the volume
    • Instace store volumes are not configuratble (SSD or HDD, size, encryption)

7. Advanced details

IAM Role

  • IAM Role is an IAM identity that has specific permission policies
  • Roles can be used to give instances permissions to access other AWS services
    • Storing AWS credentials on EC2 instance to give it permission is highly insecure

Managing Roles

  • To attach a role to an instance, select a role from the instance profile to associate with the instance
    • An instance profile is a container for an IAM Role
  • Flexibility
    • Include the role when launching, Add a role after launching, Remove the role, Update a role's policy immediately.

User Data

  • When launching EC2 instance, you have the option of passing user data to the instance
  • User data scripts to customize the runtime environment of your instance
    • script runs the first time the instance starts by default
    • script can be configured to run every time the instance starts
  • Patch and update the instance AMI, Fetch and install software lisence keys, Istall additional software ..

Additional Advanced Setting options

  • Request Spot Instances
  • Shutdown behavior: Instance can be either terminated or stopped when OS-level shutdown is performed
  • Termination protection
  • Detailed monitoring
  • Tenancy

Configuration Considerations

Have no default setting

  • Key pair

Affect costs

  • AMI, Instance type, Configure storage, Advanced details, Regions

Cannot be modified after launching

  • AMI, Key pair, Region, Network settings: VPC, subnet, instance store

Can be modified after launching

  • Name and tags, Instance type, storage, Network settings: IP address, security groups, Advanced details: adding a role, user data scripts, EFS
저작자표시 (새창열림)

'CS > 클라우드컴퓨팅' 카테고리의 다른 글

Lec 05-1: Intro to Amazon S3  (0) 2023.10.16
Lec 04-3: Managing Amazon EC2  (0) 2023.10.15
Lec 04-1: Intro to Amazon EC2  (0) 2023.10.13
Lec 03: Cloud Platforms, AWS Intro  (1) 2023.10.13
Lec 2: Cloud Infrastructure  (1) 2023.10.13
  1. 7 Steps to launching an EC2 Instance
  2. 1. Instance name and tags
  3. 2. Choosing an Amazon Machine Image (AMI)
  4. 3. Instance type
  5. 4. Key pair
  6. 5. Network settings
  7. 6. Configure storage
  8. 7. Advanced details
  9. Configuration Considerations
'CS/클라우드컴퓨팅' 카테고리의 다른 글
  • Lec 05-1: Intro to Amazon S3
  • Lec 04-3: Managing Amazon EC2
  • Lec 04-1: Intro to Amazon EC2
  • Lec 03: Cloud Platforms, AWS Intro
호프
호프
Untitled호프 님의 블로그입니다.
호프
Untitled
호프
전체
오늘
어제
  • 분류 전체보기 (341)
    • 오류😬 (4)
    • 스터디📖 (96)
      • 웹 개발 기초 (8)
      • Spring (20)
      • ML, DL (30)
      • Node.js (22)
      • React (0)
      • 블록체인 (12)
      • Go (3)
      • Javascript (1)
    • 알고리즘💻 (153)
      • 그리디 (23)
      • Bruteforce&Backtracking (16)
      • DP (17)
      • 이분탐색&정렬&분할정복 (17)
      • 누적합&투포인터 (6)
      • 스택&큐&덱 (19)
      • 그래프(DFS&BFS) (19)
      • 트리 (7)
      • 우선순위큐&다익스트라 (11)
      • 벨만포드&플로이드와샬 (8)
      • map&set&number theory (5)
      • 기타 (5)
    • 프로젝트 (3)
      • 캡스톤 디자인 프로젝트 (3)
    • 블록체인🔗 (3)
      • Solana (2)
      • 개발 (0)
      • Harmony (1)
    • ASC (6)
    • CS (73)
      • 데이터베이스 (12)
      • 클라우드컴퓨팅 (21)
      • 운영체제 (11)
      • 컴퓨터네트워크 (14)
      • 블록체인응용 (15)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • 복습

최근 댓글

최근 글

hELLO · Designed By 정상우.v4.2.1
호프
Lec 04-2: Using Amazon EC2
상단으로

티스토리툴바

단축키

내 블로그

내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W

블로그 게시글

글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C

모든 영역

이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift + /
⇧ + /

* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.