공유 AMI로부터 가상 머신 시작하기
This이 workshop워크샵 section섹션에서는 walks워크샵의 you뒷부분에서 through분석을 setting실행하는 up데 your사용할 own사전 제작된 AMI에서 자체 EC2 Linux instance인스턴스를 from설정하는 a방법을 premade AMI, which you will use to run analyses in later sections of the workshop.안내합니다.
We’ll여기서는 beNUS와 using an image built by theGIS의 Chen LabLab에서 at구축한 NUS이미지를 and사용할 GIS.것입니다. This여기에는 has박테리아(및 a일반) lot유전체학에 of유용한 common많은 tools공통 useful도구가 for설치되어 bacterial있습니다. (and general) genomics installed. We have documented이 whatAMI에 is무엇이 on있고 this어떻게 AMI설정되었는지는 and함께 how it was set up on our제공되는 accompanying GitHub repository리포지토리에 문서화되어 있습니다. Those이러한 instructions지침은 may다른 be시스템에서 useful동일한 if소프트웨어를 you설정하려는 want경우 to유용할 set수 up있으며, the자신의 same작업을 software위해 on다른 another소프트웨어를 system설치할 and때 may몇 help가지 you힌트를 with얻을 some수 hints when installing other software as well for your own work.있습니다.
Specifically,구체적으로 you다음과 learn같은 how방법을 to:배웁니다:
a. Sign in to the AWS Management관리 Console콘솔에 and로그인하여 explore it.탐색합니다.
b. Create anAMI에서 Amazon EC2 instance인스턴스를 from an AMI.생성합니다.
c. SSH into an EC2 instance인스턴스에 andSSH로 run접속하여 Linux commands.명령을 실행합니다.
Launch the EC2 Dashboard
대시보드 시작
-
In theAWSManagement관리Console콘솔search검색bar, type창에 EC2를 입력합니다. -
ChooseEC2를to open the선택하여 EC2 Dashboard를 엽니다.
Spend대시보드의 a레이아웃에 few익숙해지는 minutes데 familiarizing몇 yourself분 with정도 the시간을 layout of the dashboard:할애하세요:
Left왼쪽pane:창:Tools and features, such as the saved저장된 AmazonMachine머신Images이미지(AMIs)AMI),storage스토리지volumes,볼륨and및 sshkeys.키와 같은 도구 및 기능입니다.Center:가운데:Resource리소스listings목록and및the인스턴스ability시작to launch an instance.기능.Right오른쪽pane:창:General문서information,및such가격as등의documentation일반and pricing.정보.
LaunchEC2 an인스턴스 시작
이제 EC2 InstanceLinux
We기반 will인스턴스를 now launch an EC2 Linux-based instance.시작하겠습니다.
Click onLaunch Instance,을then클릭한click다음 드롭다운 메뉴에서 LaunchinstanceInstance을again다시from the drop down menu.클릭합니다.
On theLaunch an instancepage,페이지에서you인스턴스의can원하는choose이름을a지정할friendly수name있습니다.for your instance.

Click onAdd additional tagsand를“클릭하고 "AddTag”Tag"를 클릭합니다.You인스턴스에will대해find제공한the"Name"을“Name”찾을you수provided있습니다.for이제your키와instance.값을Now입력합니다.enter이the키(더key정확하게는and태그)는value.인스턴스가These시작되면keys,콘솔에more나타납니다.correctly이를known통해as복잡한a환경에서tags,실행will중인appear머신을in쉽게the추적할console수once있습니다.the이전에instance키launches.쌍에It사용한makes것과it유사한easy태그를to추가로keep생성하여track이of머신에running사용자와machines부여in키를a지정하고complex동일한environment.값을Create입력합니다.additional준비가tags similar for the ones you used for the key pair previously - give a user and grant key to this machine, and enter the same values. When ready, selectInstances, Volumes, Network interfacesunder the되면 Resource types 아래에서 Instances, Volumes, Network interfaces 선택합니다.
UnderApplication and OS images (Amazon Machine Image) 아래에서enter검색the상자에 교육용으로 공유된 AMIIDID를shared for the training into the search box. The입력합니다. AMI는may사진과differ다를from수the있으므로one강사의pictured;안내를refer참조하세요.to instructor’s directions.
Note:
For이this교육을training, search for위해CHENLAB-PUBLIC
을and검색하여choose가장the most recent최신 AMIversion;버전(2022년as9월of September, 2022 this is v2.10b, which has기준, IDami-0d36350156cb783e8
인 v2.10b)을 선택하시기 바랍니다.You can find out more about CHENLAB-PUBLIC AMIs in Appendix: About the AMI.

- Community AMIs에서 결과를 클릭합니다.
The검색results of the search appear결과는inCommunity AMIs에and표시됩니다.in AWS Marketplace.Click on the resultsin Community AMIs.
The AMI ID will now appear.Click on theSelectbutton to select the AMI.Be sure to select the lastest version of the AMI (see above, Step 4. Note).-
UnderSelect 버튼을 클릭하여 AMI를 선택합니다. 최신 버전의 AMI를 선택해야 합니다(위 4단계 참고 참조). - Instance type
,에서click드롭다운on화살표를the클릭하고drop-down arrow and type검색창에t3a.mediumc5.4xlarge을into입력합니다.the
search bar.
Select the key pair that you created in the beginning of this lab from the drop-down list underKey pair (login) 아래의 드롭다운 목록에서 이 실습의 시작 부분에서 만든 키 쌍을 선택합니다.
Next click onEditagainst다음으로 Network settings에 대해 Edit을 클릭합니다.You will be prompted to provideSubnetand및 Security groupdetails.세부The정보를security입력하라는groups메시지가will be your firewall rules.a. Note that the Subnet field can be configured to launch the instance in a specific Availability Zone; while we are keeping the default for this workshop, this gives you control over the location of your machine.b. Provide a name for your new security group.NOTE: For the purpose of this lab use your “[Your initials]-sec-group”.c. Confirm an existing SSH rule exists which allows TCP port 22.d. To accept connections from anywhere, select the drop-down box under theSource typecolumn and selectAnywherewhich will correspond to0.0.0.0/0.
특별히 네트워크 설정 수정할 것은 없습표시됩니다. 앞에서 launch-wizard-1으로 새로운 보안 그룹이 만들어졌다면 이제 +1증가해서 자동으로 launch-wizard-2라는 보안 그룹 이름이 부여된다는 점을 확인해주세요. 보안 그룹은launch-wizard-1이방화벽만들어져규칙이있다면 새로 만들지 않고 이것으로 설정해도 무방합됩니다.(앞 챕터에서 진행했다면 만들어진 보안 그룹을설정사용할내용이수도동일하므로)있습니다.
- Under Configure storage, you have the ability to modify or add storage and disk drives to the instance. For this lab, we will simply accept the storage defaults.
- Review your configuration under Summary and click Launch Instance.
Your instance will now start, which may take a moment. You will be shown the Launch Status page with the message Successfully initiated launch of instance.
- On the lower right of the page click on View all Instances to view the list of EC2 instances. Click on your instance. It will go through an initialization process. Once your instance has launched, you will see your Linux server as well as the Availability Zone the instance is in, and the publicly routable DNS name.
SSH into an EC2 instance
The operating system of your local computer determines the options that you have to connect from your local computer to your Linux instance. Here are directions to connect from Windows Using PuTTY or OpenSSH, From Linux & MacOS-X using ssh client and from Windows Subsystem for Linux (WSL) using ssh client.
Note: The premade CHENLAB-PUBLIC AMI is Ubuntu, so your username will be “ubuntu”
Connecting from Windows using PuTTY
We will now use the private .ppk file of the key pair generated earlier to open a SSH session to the EC2 instance.
-
Start the PuTTy application.
-
Enter in the IP address of the EC2 instance in the Host Name (or IP address) field.
-
To save the session (so we dont have to repeat the configuration everytime) provide a name in the Saved Sessions field.
-
In the left navigation pane under Connections clickon SSH and next click on Auth.
-
In the Private key file for authentication field click Browse and browse in the .ppk file downloaded when creating the key pair earlier.
-
Next in the left navgation pane click on Session (scroll up if you need to) and and further click on Save to save the session.
-
Next click on Open to start the SSH session.
-
PuTTy will now attempt to start an SSH Session.
NOTE: You will get a security Alert The Servers host key is not cached in the registry, click on Yes to continue.
-
You will now be presented with the login as prompt.
-
At the login as prompt type ec2-user if your image is Amazon Linux OS or ubuntu if your image is Ubuntu Linux OS and hit enter.
You would have now logged into the EC2 instance on AWS.
Connecting from Windows using MobaXterm
We will use the private .pem key pair to open an SSH session to the EC2 instance.
-
Start the MobaXterm application.
-
To open a session, click on Session in the top-left corner, then click SSH.
-
Enter in the IP address of the EC2 instance in the Host Name field.
-
To the right, select username and enter your username for the session.
NOTE: Username to be used here is ec2-user if your image is Amazon Linux OS and ubuntu if your image is Ubuntu Linux OS.
-
Below, click on Advanced Settings, and select private key (use your .pem file).
-
Click Ok.
MobaXterm will have logged you in to your EC2 instance.
Connecting from Windows using Windows Subsystem for Linux
We will now use the private .pem file of the key pair generated earlier to open a SSH session to the EC2 instance.
- Copy the private key from Windows to WSL - In a WSL terminal window, copy the .pem file (for the key pair that you specified when you launched the instance) from Windows to WSL. Note the fully-qualified path to the .pem file on WSL to use when connecting to your instance.
cp /mnt/<Windows drive letter>/path/my-key-pair.pem ~/WSL-path/my-key-pair.pem
- In a terminal window, use the ssh command to connect to the instance. You specify the path and file name of the private key (.pem), the user name for your instance, and the public DNS name or IP Address.
NOTE: Username to be used here is ec2-user if your image is Amazon Linux OS and ubuntu if your image is Ubuntu Linux OS.
sudo ssh -i /path/my-key-pair.pem ubuntu@<ip-address>
you will see the following response
The authenticity of host '<ip-address>'
can't be established.
RSA key fingerprint is 1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f.
Are you sure you want to continue connecting (yes/no)?
- Enter Yes
you will now be logged into the EC2 Instance.
Connecting using SSH on Linux & MacOS and OpenSSH on Windows
We will now use the private .pem file of the key pair generated earlier to open a SSH session to the EC2 instance.
- In a terminal window, use the ssh command to connect to the instance. You specify the path and file name of the private key (.pem), the user name for your instance, and the public DNS name or IP Address of your instance.
NOTE: Username to be used here is ubuntu if your image is based on the Ubuntu Linux OS and ec2-user if your image is based on Amazon Linux OS. (See this page which covers many of the common AMI OSs.)
ssh -i /path/my-key-pair.pem ubuntu@<ip-address>
You see a response like the following:
The authenticity of host 'ec2-198-51-100-1.compute-1.amazonaws.com (198-51-100-1)' can't be established.
ECDSA key fingerprint is l4UB/neBad9tvkgJf1QZWxheQmR59WgrgzEimCG6kZY.
Are you sure you want to continue connecting (yes/no)?
- Enter Yes
You will now be logged into the Instance.
NOTE: you might need to change the permissions of the key file by running the chmod command as follows. Edit to match your path and key pair name.
sudo chmod 600 /path/my-key-pair.pem
For detailed directions on these please have a look at the following links:
PuTTY, Windows Susbsystem for Linux, MacOS-X ssh Client, Linux ssh client
예)