小夥伴們的 DataWorld
      • 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
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners 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 No publishing access yet

      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.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      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 New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Make a copy 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
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners 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 No publishing access yet

    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.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # AWS Glue 簡易介紹 ## 一、概述 AWS Glue 是亞馬遜雲端運算服務(AWS)所提供的無伺服器(serverless)資料整合服務,設計目的是為了簡化、加速並自動化大規模資料處理與 ETL(Extract, Transform, Load)工作流程。 * ETL 簡易介紹: * 資料提取 (Extract):從各種資料來源 (例如 S3、RDS、DynamoDB、Redshift 或其他外部資料庫、API) 提取資料。 * 資料轉換 (Transform):清理、轉換和豐富資料以滿足分析或儲存需求。 * 資料載入 (Load):將處理後的資料載入目標系統,例如 Redshift、S3、Athena 或其他資料庫。 故使用者無需部署或管理任何基礎設施,即可在雲端中快速建構適合自己的 Data Pipeline,並將處理後資料匯入分析平台或資料倉儲中做後續使用。 ## 二、核心組件 ### 1. Crawlers (資料爬蟲) * 功能:自動掃描資料來源,推斷資料結構 (schema) 並將元資料儲存到 Data Catalog 中。 * 運作方式: * 使用者指定資料來源 (如 S3、JDBC 資料庫)。 * Crawler 自動判斷資料格式和結構,生成表格定義。 * 可設定排程,定期更新元資料已反映資料變化。 * 特點:快速建立資料目錄,無需手動定義 schema。 ### 2. Data Catalog (資料目錄) * 功能:Data Catalog 是一個集中式元資料儲存庫,用於儲存資料的結構化資訊 (如表格定義、欄位型別、資料來源等)。 * 用途:作為 AWS Glue 的核心,Data Catalog 為其他 AWS 服務 (如 Athena、Redshift Spectrum、EMR 等) 提供元資料支援,方便查詢和管理資料。 * 特點: * 支援自動生成元資料 (透過 Glue Crawlers)。 * 與 [Apache Hive Metastore](https://hive.apache.org/) 相容。 * 支援多種資料格式 (CSV、JSON、Parquet、Avro 等)。 * 提供版本控制,追蹤資料結構的變化。 ### 3. ETL Jobs * 功能:執行資料提取、轉換和載入的任務。 * 程式語言: * 支援 Python (基於 PySpark)。 * 支援 Scala (基於 Spark)。 * 提供內建轉換函數 (如過濾、聚合、聯接、格式轉換)。 * 執行環境:基於 Apache Spark 的分散式處理,適合大規模資料集。 ### 4. Trigger (觸發器) * 功能:用於自動化 ETL 作業的執行。 * 類型: * Schedule Trigger (排程觸發):按時間表 (如每天、每小時) 執行作業。 * Event Trigger (事件觸發):根據特定事件 (如 S3 新增檔案) 觸發作業。 * Condition Trigger (條件觸發):當其他作業完成後觸發。 ### 5. Workflows (工作流程) * 功能:將多個 Crawlers 和 ETL Job 組合為一個協調的工作流程。 * 用途:管理複雜的資料管道,確保作業按順序或依賴關係執行。 ### 6. Glue Studio (視覺化工具) * 功能:提供圖形化介面,允許使用者以拖拉方式設計 ETL 流程,無需編寫程式碼。 * 優勢:降低技術門檻,適合非程式設計背景的使用者。 ### 7. Glue DataBrew (資料準備工具) * 功能:專為資料清理和準備設計,提供視覺化工具來執行資料處理、標準化、異常檢測等操作。 * 用途:更偏資料分析師工具,屬於補充性服務,若有需求才做使用,不影響整體工作流邏輯。 ## 三、工作流程範例 ![image](https://hackmd.io/_uploads/HJ8IEiR7lg.png) 架構圖來源:https://docs.aws.amazon.com/zh_tw/glue/latest/dg/components-key-concepts.html ### 1.建立資料目錄 * 配置 Crawler,掃描資料來源 (如 S3、RDS)。 * 將推斷的 schema 儲存到 Data Catalog。 ### 2.設計 ETL 作業 * 使用 Glue Studio 或手動編寫 Python/Scala 程式碼。 * 定義資料來源、轉換邏輯和目標儲存位置。 ### 3.設定觸發器和工作流程 * 配置觸發器已自動執行作業。 * 組合多個作業形成工作流程。 ### 4.執行與監控 * 執行 ETL 作業,AWS Glue 自動分配資源。 * 使用 [Amazon CloudWatch](https://aws.amazon.com/tw/cloudwatch/) 監控作業執行狀態和效能。 ### 5.資料查詢與分析 * 透過 Data Catalog 與其他 AWS 服務 (如 Athena、Redshift) 整合,進行資料查詢和分析。 ## 四、常見應用場景 ### 1.資料湖構建 * 從多個來源 (結構化/非結構化) 提取資料,轉換為統一格式 (如 Parquet),儲存到 S3 資料湖。 * 與 [AWS Lake Formation](https://aws.amazon.com/tw/lake-formation/) 結合,實現資料湖治理。 ### 2.資料倉儲載入 * 將資料轉換後載入 [Amazon Redshift](https://aws.amazon.com/tw/redshift/) 或其他資料倉儲,支援 [Amazon QuickSight](https://aws.amazon.com/tw/quicksight/?trk=3f83a749-ef31-4aad-aad6-363c666e9181&sc_channel=ps&ef_id=CjwKCAjwvO7CBhAqEiwA9q2YJaHQct_pupvXlvWyzRegj2QRG1jXwBd1t9ZlSWXHEqmSPUXdu-r9uhoC7LgQAvD_BwE:G:s&s_kwcid=AL!4422!3!651541934794!e!!g!!quicksight!19828212417!147297605659&gad_campaignid=19828212417&gbraid=0AAAAADjHtp_DZ1eeKd-GcSDerlSJTH5n3&gclid=CjwKCAjwvO7CBhAqEiwA9q2YJaHQct_pupvXlvWyzRegj2QRG1jXwBd1t9ZlSWXHEqmSPUXdu-r9uhoC7LgQAvD_BwE&amazon-quicksight-whats-new.sort-by=item.additionalFields.postDateTime&amazon-quicksight-whats-new.sort-order=desc) 等 BI 可視化報表分析。 ### 3.即時資料處理 * 透過 [AWS Glue Streaming](https://docs.aws.amazon.com/glue/latest/dg/streaming-chapter.html) 處理來自 [Amazon Kinesis](https://aws.amazon.com/tw/kinesis/) 或 [Amazon Managed Streaming for Apache Kafka](https://aws.amazon.com/tw/msk/) 的即時資料流。 ### 4.資料清理與標準化 * 使用 [AWS Glue DataBrew](https://aws.amazon.com/tw/glue/features/databrew/) 清理不一致的資料,準備分析或機器學習模型,為 No Code 的資料應用服務。 ### 5.資料整合和遷移 * 將內部部署資料庫 (透過 JDBC) 遷移到 AWS 雲端。 * 整合來自不同系統的資料 (如 CRM、ERP、日誌資料)。 ### 6.機器學習資料準備 * 清理和轉換資料,為 [Amazon SageMaker](https://aws.amazon.com/tw/sagemaker/?trk=346c6f6e-fbca-42ed-9c22-666d71fff455&sc_channel=ps&ef_id=CjwKCAjwvO7CBhAqEiwA9q2YJXqc0TIND-cGj2B3TQT5O4yidOpinUvBg5fPF-spVfXjMaht8oN1_RoCoXkQAvD_BwE:G:s&s_kwcid=AL!4422!3!639434067723!e!!g!!sagemaker!19155106685!149379722812&gad_campaignid=19155106685&gbraid=0AAAAADjHtp8ogHtPFllENa0ZLZJYq5eal&gclid=CjwKCAjwvO7CBhAqEiwA9q2YJXqc0TIND-cGj2B3TQT5O4yidOpinUvBg5fPF-spVfXjMaht8oN1_RoCoXkQAvD_BwE) 或其他 ML 平台提供高品質資料集。 ## 五、計費方式 > 依照文章撰寫當下 Glue 計費形式介紹 ### 1.Crawler * 按執行時間和使用的 DPU (Data Processing Unit) 計費。 * DPU(資料處理單位)是 AWS Glue 中的計算資源單位,全名為 Data Processing Unit。 * DPU 是 AWS 為 Glue Job、Crawlers 等運算任務所使用的計費與資源分配單位。 * 每個 DPU 約等於:4 vCPU (虛擬 CPU)、16GB RAM。 ### 2.ETL Job * 按作業執行的 DPU 小時計費。 ### 3.Data Catalog 儲存 * 按儲存的元資料物件數量計費。 ### 4. 費用參考連結 * AWS Glue pricing:https://aws.amazon.com/glue/pricing/?nc1=h_ls ## 六、注意事項 ### 1.學習曲線較高 * 對於進階轉換或自訂邏輯,需熟悉 PySpark 或 Scala。 * Glue Studio 雖然簡化操作,但複雜需求仍須編寫程式碼。 ### 2.成本考量 * 大規模作業或頻繁的 Crawler 執行可能導致成本上升。 * 使用者需優化作業以控制費用。 ### 3.效能限制 * 對於極高吞吐量的即時資料流,Glue Streaming 可能不如專用工具 (如 Flink)。 * 啟動時間較長 (Spark 環境初始化),不適合超低延遲場景。 ### 4.功能限制 * 某些複雜轉換可能需要外部工具 (如 AWS Lambda 或 EMR )。 * Data Catalog 的功能相對簡單,對於進階元資料管理需結合 Lake Formation。 ## 七、總結 1. 簡化基礎設施管理,學習曲線適中: AWS 託管服務免除了自行部署資料基礎設施的負擔,讓使用者專注於資料處理邏輯。雖然初期學習曲線較陡,但熟悉服務功能後,使用體驗將變得簡單且高效。 2. 靈活支援多樣化資料與應用場景: 該服務能處理結構化、半結構化及非結構化資料,並支援批次處理(Batch)與串流處理(Streaming)等多種應用場景,極具靈活性與便利性。 3. 評估場景以應對潛在限制: 儘管 AWS 託管服務功能強大,但受限於其底層配置,對於高度複雜或特殊化的場景可能存在限制。建議在使用前詳細評估應用場景,確保服務滿足需求並避免潛在的技術瓶頸。

    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
    Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    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