iT邦幫忙

2021 iThome 鐵人賽

DAY 26
0
DevOps

運用皮毛技術與 AWS 平台、打造雲端蘿蔔服務三十天系列 第 26

【Day 26】S3 on AWS Outpost 限制與建置流程

tags: 鐵人賽 AWS S3 Outposts S3 Bucket

前言

  • 昨天我們成功把 K8S 的資源,部署到 AWS Outpost EKS 環境中。
  • 因為即將進入尾聲,我覺得差不多最後一篇關於 Outpost 的文章就來討論 S3。

前置作業

當你已擁有一個隸屬於 AWS Outposts 組織下的帳號,並且被共享了相關資源後⋯⋯

參考資料

  1. Amazon S3 on Outposts
  2. CreateBucket on AWS Outposts
  3. Run applications on premises and access Amazon S3 objects from AWS Outposts

限制

  • 完整的資料請參考 AWS 文件
    • Outposts 儲存貯體大小上限為 50 TB
    • 每座 Outpost 內的 S3 Bucket (儲存貯體)上限為 100
    • 只能使用 Access Point 和 Endpoint 存取 Outposts S3 Bucket
    • 每個 Outpost Bucket Access Point 上限為 10
    • Access Point policy 的大小限制為 20 KB
    • 所有儲存在 S3 on Outposts 上的物件都儲存在 OUTPOSTS 儲存類別中。
    • 存放在 OUTPOSTS 儲存體類別中的所有物件預設為使用伺服器端加密與 Amazon S3 受管加密金鑰 (SSE-S3) 進行儲存
    • 您也可以明確選擇使用伺服器端加密與客戶提供的加密金鑰 (SSE-C) 來存放物件
  • 了解以上限制後,確定這些步驟只能透過指令或程式去建立 S3 Bucket on Outpost

詳細作法

四步驟:建 Bucket, 建 Access Point, 建 Endpoint, 開心使用

  • s3control 指令文件連結
  1. 以 Outpost Owner 身份,建立 S3 on Outposts bucket

    • 執行命令 (需由 Outpost Owner AWS account 執行)
      aws s3control create-bucket \
          --bucket nipapa-dev-s3-bucket \
          --outpost-id op-xxxxxxxxxxxx \
          --profile xxx
      

    Outpost Owner 在 Outpost 上建立 Bucket;

    *目前尚不支援透過 RAM 分享這個建立權限給 Linked Account

    • Outpost Owner console
    • Linked Account console (對照上圖,左側功能欄沒有 Outposts 的限定功能)
    • 從 Outposts console 可以叫出這個秘密功能!!
  2. 以 Outpost Owner 身份,建立 Access Point for an S3 on Outposts bucket 輸入指令

    • 所謂的 S3 Access Point 指的是,開放給其他 AWS 服務,使那些服務可以透過 AWS Private Network,長得像是 arn:aws:s3:<region>:<account-id>:<access-point-name>
    • 這個 Access Point 是要用來接取 VPCAWS (也就是 S3 Bucket on Outpost)
    • 建立 Access Point
      • 可以允許同 Region 下,不同 Account 的 VPC Endpoint 接進來
      • 參考架構示意圖
    • 執行命令
      aws s3control create-access-point \
          --account-id 111111111111<outpost owner> \
          --name nipapa-dev-s3-bucket \
          --bucket "arn:aws:s3-outposts:ap-northeast-1:111111111111:outpost/op-xxxxxxxxxxxx/bucket/nipapa-dev-s3-bucket" \
          --vpc-configuration VpcId=vpc-1234567890abcedf0 \
          --profile xxx
      
      • 其中,VPC 可為
        • Outposts 管理者所建立,並且分享給 Linked Account 的
        • 由 Linked Account 分享給的 Outposts 管理者的
    • 回傳結果
      {
          "AccessPointArn": "arn:aws:s3-outposts:ap-northeast-1:111111111111:outpost/op-xxxxxxxxxxxx/accesspoint/nipapa-dev-s3-bucket"
      }
      (END)
      
    • 再來,建立第二個 S3 Access Point
      {
          "AccessPointArn": "arn:aws:s3-outposts:ap-northeast-1:111111111111:outpost/op-xxxxxxxxxxxx/accesspoint/boss-seop-accesspoint"
      }
      (END)
      
    • 剛剛的指令建立 Access Point 名字打錯了,不是我想要的,所以用下列指令查看
      aws s3control list-access-points \
          --account-id 111111111111 \
          --bucket "arn:aws:s3-outposts:ap-northeast-1:111111111111:outpost/op-xxxxxxxxxxxx/bucket/nipapa-dev-s3-bucket" \
          --profile xxx
      
    • 使用下列指令刪除
      aws s3control delete-access-point \
          --account-id 111111111111 \
          --name "arn:aws:s3-outposts:ap-northeast-1:111111111111:outpost/op-xxxxxxxxxxxx/accesspoint/boss-seop-accesspoint" \
          --profile xxx
      
    • 重新建立第二個 Access Point
      aws s3control create-access-point \
          --account-id 111111111111 \
          --name boss-s3op-accesspoint \
          --bucket "arn:aws:s3-outposts:ap-northeast-1:111111111111:outpost/op-xxxxxxxxxxxx/bucket/nipapa-dev-s3-bucket" \
          --vpc-configuration VpcId=vpc-1234567890abcedf0 \
          --profile xxx
      
      {
          "AccessPointArn": "arn:aws:s3-outposts:ap-northeast-1:111111111111:outpost/op-xxxxxxxxxxxx/accesspoint/boss-s3op-accesspoint"
      }
      (END)
      
  3. 建立 Endpoint on an Outpost

    • 上面我們提到 AP 是連結 VPC 和 服務之間的通道,那麼光有這個通道還不夠啊...
    • 那個 Access point 本身要如何跟其他服務溝通咧?
      • 我們需要替他裝上 Endpoint 啊!
      • Endpoint 會在子網段中建出四個 eni,並且提供一條服務網址來和別人溝通
    • 這邊用到的指令是 s3outposts,該指令只有三種用法,建立、刪除、列出 Outposts 上的 S3 endpoint。
    • 執行命令
      aws s3outposts create-endpoint \
          --outpost-id op-xxxxxxxxxxxx \
          --subnet-id subnet-0341959a4ebef5b98 \
          --security-group-id sg-02a2747f6477e0783 \
          --profile xxx
      
    • 若刻意使用 Linked Account 觸發指令,則會顯示 Access Denied
      aws s3outposts create-endpoint --outpost-id op-xxxxxxxxxxxx --subnet-id subnet-0341959a4ebef5b98 --security-group-id sg-02a2747f6477e0783
      
  4. 操作 S3 Objects

    • 快樂使用服務⋯⋯還有什麼能比在 VPC 內存取 Outpost 上的 S3 還快樂呢?

      明明就有啊,浪味仙快樂火鍋
      備註:浪味仙的爸爸、眼明手快的衍明蔡快樂,我就不快樂!

    • 使用 s3api 操作,以下列出資料作為範例
     aws s3api list-objects-v2 --bucket "arn:aws:s3-outposts:ap-northeast-1:111111111111:outpost/op-xxxxxxxxxxxx/accesspoint/nipapa-dev-s3-bucket" --profile xxx
    

結論

  • AWS Outpost 的介面仍然持續改善中
  • 欲使用 S3 on Outpost 這個功能必須取得 Outpost 機櫃本身的管理帳號的 AdministratorAccess Permission
  • 或者請管理員進行指令,稍微麻煩了一點
  • 這個廣泛使用的功能,目前乍看只適用在企業內網、由 IT 管理者操作的環境較為適合
  • 明天應該會寫雲端蘿蔔服務的功能!

上一篇
【Day 25】建立 EKS on Outpost 的步驟(下)
下一篇
【Day 27】差點被我遺忘的 x AWS RDS on Outpost x 雲端資料庫儲存
系列文
運用皮毛技術與 AWS 平台、打造雲端蘿蔔服務三十天30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言