KangMoo
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # AWS EC2 Amazon Web Services(AWS)는 클라우드 컴퓨팅 서비스를 제공하는 대표적인 플랫폼이다. 그 중에서도 EC2(Elastic Compute Cloud)는 AWS에서 가장 핵심적인 서비스 중 하나로, 사용자가 원하는 만큼의 컴퓨팅 자원을 손쉽게 이용할 수 있게 해준다. ## EC2란 무엇인가? EC2는 Elastic Compute Cloud의 약자로, AWS에서 제공하는 가상 서버 서비스이다. EC2를 사용하면 물리적인 서버를 직접 구입하고 관리할 필요 없이, AWS가 제공하는 가상 서버를 필요에 따라 생성하고 사용할 수 있다. EC2는 확장성, 유연성, 경제성의 장점을 제공한다. ## EC2의 주요 개념 ### 인스턴스 인스턴스는 EC2에서 실행되는 가상 서버이다. 사용자는 필요에 따라 인스턴스를 생성하고 종료할 수 있다. 각 인스턴스는 특정한 컴퓨팅 리소스(예: CPU, 메모리, 스토리지 등)를 갖는다. ### AMI (Amazon Machine Image) AMI는 인스턴스를 생성하기 위한 템플릿이다. AMI에는 운영 체제, 애플리케이션 서버, 그리고 애플리케이션 등이 포함될 수 있다. 사용자는 AWS에서 제공하는 AMI를 선택하거나 자신만의 AMI를 생성할 수 있다. ### 인스턴스 유형 인스턴스 유형은 인스턴스의 하드웨어 사양을 결정한다. 예를 들어, CPU 코어 수, 메모리 크기, 네트워크 성능 등이 포함된다. AWS는 다양한 용도에 맞춘 여러 인스턴스 유형을 제공한다. ### 키 페어 키 페어는 인스턴스에 안전하게 접속하기 위한 인증 방법이다. 키 페어는 공개 키와 개인 키로 구성된다. 인스턴스를 생성할 때, AWS는 사용자가 제공한 공개 키를 인스턴스에 저장하고, 사용자는 개인 키를 사용하여 인스턴스에 접속한다. ### 보안 그룹 보안 그룹은 인스턴스에 대한 네트워크 접근을 제어하는 가상 방화벽이다. 사용자는 보안 그룹을 통해 인스턴스에 대한 인바운드 및 아웃바운드 트래픽을 허용하거나 차단할 수 있다. ### Elastic IP Elastic IP는 고정된 퍼블릭 IP 주소이다. EC2 인스턴스는 기본적으로 동적 IP를 사용하나, Elastic IP를 사용하면 인스턴스가 재시작되더라도 동일한 퍼블릭 IP 주소를 유지할 수 있다. ## EC2 인스턴스 유형 AWS는 다양한 요구 사항을 충족하기 위해 여러 유형의 EC2 인스턴스를 제공한다. 각 인스턴스 유형은 특정 용도에 최적화되어 있다. ### 범용 인스턴스 범용 인스턴스는 균형 잡힌 컴퓨팅, 메모리 및 네트워크 자원을 제공한다. 일반적인 애플리케이션에 적합하다. - 예: t2.micro, t3.medium, m5.large ### 컴퓨팅 최적화 인스턴스 컴퓨팅 최적화 인스턴스는 CPU 집약적인 워크로드에 적합하다. 고성능 프로세서가 필요할 때 사용한다. - 예: c5.large, c5n.xlarge ### 메모리 최적화 인스턴스 메모리 최적화 인스턴스는 메모리 집약적인 애플리케이션에 적합하다. 대규모 데이터베이스나 인메모리 캐싱에 사용한다. - 예: r5.large, x1e.xlarge ### 스토리지 최적화 인스턴스 스토리지 최적화 인스턴스는 고속의 로컬 스토리지가 필요한 애플리케이션에 적합하다. 대규모 데이터 처리 작업에 유리하다. - 예: i3.large, d2.xlarge ### 가속화 인스턴스 가속화 인스턴스는 GPU, FPGA와 같은 하드웨어 가속기를 포함하여, 과학적 계산, 머신 러닝, 그래픽 처리에 적합하다. - 예: p3.2xlarge, f1.2xlarge ## EC2 인스턴스 시작하기 이제 EC2 인스턴스를 생성하고 실행하는 방법을 단계별로 알아보겠다. ### AWS 계정 생성 먼저 AWS 계정을 생성해야 한다. [AWS 계정 생성 페이지](https://aws.amazon.com/)에 접속하여 필요한 정보를 입력하고 계정을 생성한다. ### EC2 대시보드 접속 AWS 계정을 생성하고 로그인한 후, AWS Management Console에서 EC2 대시보드로 이동한다. 검색 창에 "EC2"를 입력하여 EC2 서비스를 선택한다. ### 인스턴스 시작 1. **인스턴스 시작 버튼 클릭**: EC2 대시보드에서 "인스턴스 시작" 버튼을 클릭한다. 2. **AMI 선택**: AWS에서 제공하는 다양한 AMI 중 하나를 선택한다. 예를 들어, "Amazon Linux 2 AMI"를 선택할 수 있다. 3. **인스턴스 유형 선택**: 인스턴스 유형을 선택한다. 예를 들어, 무료 티어를 이용하려면 "t2.micro"를 선택한다. 4. **인스턴스 구성**: 인스턴스 구성 단계에서 기본 설정을 유지하거나 필요한 설정을 변경한다. 5. **스토리지 추가**: 인스턴스에 연결할 스토리지를 설정한다. 기본 설정을 사용할 수 있다. 6. **태그 추가**: 인스턴스를 식별하기 위해 태그를 추가할 수 있다. 예를 들어, "Name" 태그를 추가하고 "MyFirstInstance"라고 입력할 수 있다. 7. **보안 그룹 구성**: 보안 그룹을 설정하여 인스턴스에 대한 접근을 제어한다. 새 보안 그룹을 생성하고 SSH(포트 22)를 허용하는 규칙을 추가한다. 8. **키 페어 생성**: 새 키 페어를 생성하거나 기존 키 페어를 선택한다. 키 페어를 다운로드하여 안전한 장소에 저장한다. ### 인스턴스 시작 완료 모든 설정을 완료한 후, "인스턴스 시작" 버튼을 클릭하면 인스턴스가 생성되고 실행된다. 몇 분 후, 인스턴스가 실행 상태로 전환된다. ## EC2 인스턴스 관리 EC2 인스턴스를 시작한 후, 이를 관리하는 방법을 알아보겠다. ### 인스턴스 상태 확인 EC2 대시보드에서 "인스턴스" 메뉴를 선택하면 현재 실행 중인 모든 인스턴스를 확인할 수 있다. 각 인스턴스의 상태, 퍼블릭 IP 주소 등을 확인할 수 있다. ### 인스턴스 접속 인스턴스에 SSH를 통해 접속할 수 있다. 예를 들어, Linux나 Mac에서는 터미널을 열고 다음 명령어를 입력한다. ```bash ssh -i /path/to/your-key.pem ec2-user@your-instance-public-ip ``` Windows 사용자는 PuTTY를 사용하여 접속할 수 있다. 키 페어 파일(.pem)을 .ppk 형식으로 변환한 후, PuTTY에서 변환된 키 파일을 사용하여 접속한다. ### 인스턴스 중지 및 시작 인스턴스를 일시적으로 사용하지 않을 때는 중지할 수 있다. 중지된 인스턴스는 다시 시작할 수 있다. 인스턴스를 중지하려면 인스턴스를 선택하고 "인스턴스 상태" 메뉴에서 "중지"를 선택한다. 다시 시작하려면 "시작"을 선택한다. ### 인스턴스 종료 더 이상 인스턴스가 필요 없을 때는 종료할 수 있다. 종료된 인스턴스는 복구할 수 없으므로 주의해야 한다. 인스턴스를 종료하려면 인스턴스를 선택하고 "인스턴스 상태" 메뉴에서 "종료"를 선택한다. ## EC2 사용 예제 EC2를 이용하여 Amazon Linux 2 AMI를 사용하여 Apache 웹 서버를 설치하고 실행하는 간단한 예제를 살펴보자 ### 인스턴스 생성 앞서 설명한 단계를 따라 Amazon Linux 2 AMI를 사용하여 t2.micro 인스턴스를 생성한다. ### Apache 설치 및 실행 인스턴스에 접속한 후, 다음 명령어를 실행하여 Apache 웹 서버를 설치하고 실행한다. ```bash sudo yum update -y sudo yum install httpd -y sudo systemctl start httpd sudo systemctl enable httpd ``` ### 보안 그룹 설정 EC2 대시보드에서 인스턴스의 보안 그룹을 수정하여 HTTP(포트 80) 트래픽을 허용한다. 이를 통해 외부에서 웹 서버에 접속할 수 있다. ### 웹 서버 확인 웹 브라우저를 열고 인스턴스의 퍼블릭 IP 주소를 입력하면 Apache 테스트 페이지를 볼 수 있다. ```plaintext http://your-instance-public-ip ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully