MAX
    • 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 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
    • 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 Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
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
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 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介紹 | 打造雲端無伺服器資料處理管道》 ![image](https://hackmd.io/_uploads/S1rJ0E1Oee.png) ## 📒 前言:為何選擇 AWS Glue? 在數據驅動的時代,企業每天都會產生大量的原始資料。然而,這些原始資料往往需要經過清洗、轉換、格式化,才能被下游的分析工具、視覺化報表或機器學習模型所使用。這個過程被稱為 ETL(Extract, Transform, Load)。 AWS Glue 是一個全受管的無伺服器 ETL 服務,它能讓您輕鬆地準備與載入資料,而無需費心管理底層的運算資源。本篇文章將透過一個實戰演練,帶您了解如何使用 AWS Glue Studio 的視覺化介面,快速建立一個自動化的資料處理管道。 ![image](https://hackmd.io/_uploads/rJoj4EkOge.png) > Source: [Catalog and analyze Application Load Balancer logs more efficiently with AWS Glue custom classifiers and Amazon Athena](https://aws.amazon.com/tw/blogs/big-data/catalog-and-analyze-application-load-balancer-logs-more-efficiently-with-aws-glue-custom-classifiers-and-amazon-athena/) ## 📒 核心服務概覽 ### 📘 AWS Glue * **無伺服器 (Serverless) 的 ETL 利器:** Glue 提供一個全自動化的資料擷取、轉換與載入(ETL)環境。它底層使用 Apache Spark 引擎,並支援 PySpark 與 Python 腳本,能夠高效處理儲存在 Amazon S3、Amazon Redshift 等多種來源的資料。 * **統一的資料中樞**:Glue Data Catalog 可作為您所有資料資產的中央中繼資料儲存庫。其內建的爬蟲 (Crawler) 功能可以自動掃描您的資料來源、識別結構(Schema),並建立可供查詢的資料表,方便與 Amazon Athena、Redshift Spectrum 等服務無縫整合。 ![image](https://hackmd.io/_uploads/BJ0dBEkOee.png) > Source: [AWS官網](https://aws.amazon.com/tw/glue/) #### 彈性的開發選項 * `Glue Studio`:圖形化的 ETL 流程設計工具,讓使用者透過拖拉方式建構資料流程。 * `Glue Studio`:圖形化的 ETL 流程設計工具,讓使用者透過拖拉方式建構資料流程。 * `Glue Data Catalog`:集中管理資料結構與中繼資料的元資料儲存庫,供各服務查詢使用。 * `Glue Crawler`:自動掃描資料來源並建立或更新 Data Catalog 的 Schema。 * `Glue Jobs`:執行 ETL 任務的運算單元,支援 Python、PySpark 編碼或可視化設計。 * `Glue Workflows`:用於串接多個 Glue 元件(如 Job、Crawler)以建構完整的資料流程。 * `Glue Triggers`:用來根據事件或排程自動啟動 Glue 任務或流程。 * `Glue ML Transforms`:內建的機器學習轉換模組,協助進行資料除重或分類等任務。 ### 📘 Amazon S3 Amazon S3 (Simple Storage Service) 是 AWS 上最廣為人知的物件儲存服務。它具備高耐用性、高可用性與極佳的擴展性,可用來儲存任何格式的檔案。憑藉其直覺的操作、精細的權限控管與高度的服務整合性,S3 常被用作資料湖 (Data Lake) 的核心,也是 Glue、Athena 等資料服務最主要的資料來源。 ![image](https://hackmd.io/_uploads/HJPRUNkuex.png) > Source: [Amazon S3 in 3 Minutes: Quick Insights and Practical Examples for Easy Understanding](https://nolliechy.medium.com/amazon-s3-in-3-minutes-quick-insights-and-practical-examples-for-easy-understanding-ababf23a8e2b) ## 📒 實作演練:建立一個 Glue ETL 任務 ### 📘 核心概念:Glue Job 的運作模式 您可以將 AWS Glue Job 視為一個自動化的資料處理管道。當您需要處理資料時,可以啟動一個 Glue Job。AWS 會根據您的設定,自動佈建一台暫時的虛擬機器來執行您指定的資料處理任務。當任務完成後,該機器會被自動關閉並銷毀。 ![image](https://hackmd.io/_uploads/H1ZdSx1dlx.png) > 您可以根據任務的複雜度與資料量,選擇不同的 Worker 類型與數量。運算資源越強,單位時間的費用也越高。 ### 📘 開發方式 > 本文參考kaggle上關於電商的[資料集](https://www.kaggle.com/datasets/uom190346a/e-commerce-customer-behavior-dataset/data) #### 📗 1. 使用視覺化介面 (Glue Studio):透過拖拉節點的方式,直觀地建立資料處理步驟。** ![image](https://hackmd.io/_uploads/H1LXVgydel.png) #### 📗 2. 撰寫並上傳腳本 (Script):如果需要更複雜的客製化邏輯,可直接撰寫 PySpark 或 Python 腳本。 ![image](https://hackmd.io/_uploads/HkXLVxydll.png) ### 📘 操作步驟:使用 Glue Studio 進行資料遮罩 #### 📗 1. 準備來源與目標 S3 儲存桶 ![image](https://hackmd.io/_uploads/B1scqxkOee.png) #### 📗 2. 在 Glue Studio 中建立新任務 ![image](https://hackmd.io/_uploads/Byqnqgkdgx.png) #### 📗 3. 應用資料轉換—資料遮罩 ![image](https://hackmd.io/_uploads/H17FzNk_gg.png) #### 📗 4. 調整目標 Schema 與輸出格式 ![image](https://hackmd.io/_uploads/BJKw_SJDge.png) :arrow_down: 另外也還有很多資料轉換的功能,有興趣的可以試看 ![image](https://hackmd.io/_uploads/HkRPClkdxl.png) #### 📗 5. 儲存並執行任務,可以在點擊`start job` 之後要到 `Run Detail`裡面看跑多久、成功與否、和細節 ![image](https://hackmd.io/_uploads/BJaUTgkule.png) #### 📗 6. 驗證處理結果 這邊的設定是將資料分成`CSV`跟`Json`檔案,清理完成之後就會在資料夾看到這兩份檔案,其中在JSON檔案的電話號碼就被`SHA256`遮罩完畢 ![image](https://hackmd.io/_uploads/HywQClkule.png) ![image](https://hackmd.io/_uploads/Hy6fAlyulx.png) ## 📒 重要提示與限制 ### 📘 輸出檔案命名限制 #### 📗 AWS Glue 會自動生成輸出檔案的名稱,目前無法直接自訂有意義的檔名,算是比較明顯的缺點 ![image](https://hackmd.io/_uploads/ByjnUH1Dgx.png) #### 📗 Detect Sensitive Data 功S能有一定限制,內建的 Detect Sensitive Data 功能主要針對常見的 PII 格式,對於較不標準或客製化的欄位可能無法識別,提供客製化的選項不多 ![image](https://hackmd.io/_uploads/SJ5TEU1wel.png) #### 📗 不過當應用情景單純,做這種快速簡單的遮罩也是不錯 ![image](https://hackmd.io/_uploads/H1JS0lJdeg.png) ## REFERENCE📕📗📘📙📒 * https://aws.amazon.com/tw/blogs/big-data/get-started-with-aws-glue-data-quality-dynamic-rules-for-etl-pipelines/ * https://www.kaggle.com/datasets/uom190346a/e-commerce-customer-behavior-dataset/data

    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