Data Landing Zone
Data Landing Zone是Adobe Experience Platform布建的Azure Blob儲存體介面,可授予您存取安全、雲端式的檔案儲存設施,以將檔案帶入Platform。 您有權存取每個沙箱的一個Data Landing Zone容器,而且所有容器的資料量總計以您的Platform產品和服務授權所提供的資料量為限。 所有Experience Platform客戶都已為每個沙箱布建一個Data Landing Zone容器。 您可以透過Azure Storage Explorer或命令列介面讀取及寫入檔案至容器。
Data Landing Zone支援SAS式驗證,其資料受到標準Azure Blob存放裝置安全機制的保護。 SAS式驗證可讓您透過公用網際網路連線,安全地存取Data Landing Zone容器。 您不需要變更網路即可存取Data Landing Zone容器,這表示您不需要為網路設定任何允許清單或跨區域設定。 Experience Platform對上傳至Data Landing Zone容器的所有檔案和資料夾強制實施嚴格的七天到期時間。 所有檔案和資料夾都會在七天後刪除。
設定您在Azure上Experience Platform的Data Landing Zone來源 azure
請依照下列步驟,瞭解如何設定Data Landing Zone帳戶以在Azure上Experience Platform。
檔案和目錄的命名限制
以下是您在命名雲端儲存空間檔案或目錄時必須考慮的限制清單。
- 目錄和檔案元件名稱不能超過255個字元。
- 目錄和檔案名稱不能以正斜線(
/
)結尾。 如果提供,則會自動移除。 - 必須正確逸出下列保留的URL字元:
! ' ( ) ; @ & = + $ , % # [ ]
- 不允許下列字元:
" \ / : | < > * ?
。 - 不允許非法URL路徑字元。 類似
\uE000
的程式碼點雖然在NTFS檔案名稱中有效,但不是有效的Unicode字元。 此外,不允許使用某些ASCII或Unicode字元,例如控制字元(例如0x00
到0x1F
、\u0081
等)。 如需HTTP/1.1中Unicode字串的規則,請參閱RFC 2616,第2.2節:基本規則和RFC 3987。 - 不允許下列檔案名稱: LPT1、LPT2、LPT3、LPT4、LPT5、LPT6、LPT7、LPT8、LPT9、COM1、COM2、COM3、COM4、COM5、COM6、COM7、COM8、COM9、PRN、AUX、NUL、CON、CLOCK$、點字元(.)和兩個點字元(…)。
管理資料登陸區域的內容 manage-the-contents-of-your-data-landing-zone
您可以使用Azure Storage Explorer來管理Data Landing Zone容器的內容。
在Azure Storage Explorer UI中,選取左側導覽中的連線圖示。 選取資源 視窗會出現,提供您連線的選項。 選取 Blob container 以連線至Data Landing Zone。
接著,選取 共用存取簽章URL (SAS) 作為您的連線方法,然後選取 下一步。
選取您的連線方法後,您必須接著提供與Data Landing Zone容器相對應的 顯示名稱 和 Blob容器SAS URL。
提供您的Data Landing Zone SAS URL,然後選取 下一步
「摘要」視窗會出現,提供您設定的總覽,包括Blob端點與許可權的相關資訊。 準備就緒後,選取 連線。
成功連線會以您的Data Landing Zone容器更新您的Azure Storage Explorer UI。
在您的Data Landing Zone容器連線至Azure Storage Explorer後,您現在可以開始將檔案上傳至Data Landing Zone容器。 若要上傳,請選取 上傳,然後選取 上傳檔案。
選取要上傳的檔案後,您必須識別要上傳的Blob型別,以及您想要的目的地目錄。 完成後,選取 上傳。
使用命令列介面上傳檔案至您的Data Landing Zone
您也可以使用裝置的命令列介面,並存取上傳檔案至Data Landing Zone。
使用Bash上傳檔案
下列範例使用Bash和cURL,透過Azure Blob Storage REST API將檔案上傳至Data Landing Zone:
# Set Azure Blob-related settings
DATE_NOW=$(date -Ru | sed 's/\+0000/GMT/')
AZ_VERSION="2018-03-28"
AZ_BLOB_URL="<URL TO BLOB ACCOUNT>"
AZ_BLOB_CONTAINER="<BLOB CONTAINER NAME>"
AZ_BLOB_TARGET="${AZ_BLOB_URL}/${AZ_BLOB_CONTAINER}"
AZ_SAS_TOKEN="<SAS TOKEN, STARTING WITH ? AND ENDING WITH %3D>"
# Path to the file we wish to upload
FILE_PATH="</PATH/TO/FILE>"
FILE_NAME=$(basename "$FILE_PATH")
# Execute HTTP PUT to upload file (remove '-v' flag to suppress verbose output)
curl -v -X PUT \
-H "Content-Type: application/octet-stream" \
-H "x-ms-date: ${DATE_NOW}" \
-H "x-ms-version: ${AZ_VERSION}" \
-H "x-ms-blob-type: BlockBlob" \
--data-binary "@${FILE_PATH}" "${AZ_BLOB_TARGET}/${FILE_NAME}${AZ_SAS_TOKEN}"
使用Python上傳檔案
下列範例使用Microsoft’s Python v12 SDK將檔案上傳至Data Landing Zone:
import os
from azure.storage.blob import ContainerClient
try:
# Set Azure Blob-related settings
sasUri = "<SAS URI>"
srcFilePath = "<FULL PATH TO FILE>"
srcFileName = os.path.basename(srcFilePath)
# Connect to container using SAS URI
containerClient = ContainerClient.from_container_url(sasUri)
# Upload file to Data Landing Zone with overwrite enabled
with open(srcFilePath, "rb") as fileToUpload:
containerClient.upload_blob(srcFileName, fileToUpload, overwrite=True)
except Exception as ex:
print("Exception: " + ex.strerror)
使用AzCopy上傳檔案
下列範例使用Microsoft’s AzCopy公用程式將檔案上傳至Data Landing Zone:
copy
命令,但您可以使用AzCopy使用其他命令和選項將檔案上傳至Data Landing Zone。 如需詳細資訊,請參閱此Microsoft AzCopy 檔案。set sasUri=<FULL SAS URI, PROPERLY ESCAPED>
set srcFilePath=<PATH TO LOCAL FILE(S); WORKS WITH WILDCARD PATTERNS>
azcopy copy "%srcFilePath%" "%sasUri%" --overwrite=true --recursive=true
設定您在Amazon Web Services上Experience Platform的Data Landing Zone來源 aws
請依照下列步驟瞭解如何設定您的Data Landing Zone帳戶以在Amazon Web Services (AWS)上Experience Platform。
設定AWS CLI並執行作業
- 閱讀安裝或更新至最新版AWS CLI的指南。
使用臨時憑證設定AWS CLI
使用AWS configure
命令以存取金鑰和工作階段權杖來設定您的CLI。
aws configure
出現提示時,輸入下列值:
- AWS存取金鑰識別碼:
{YOUR_ACCESS_KEY_ID}
- AWS秘密存取金鑰:
{YOUR_SECRET_ACCESS_KEY}
- 預設區域名稱:
{YOUR_REGION}
(例如,us-west-2
) - 預設輸出格式:
json
接下來,設定工作階段權杖:
aws configure set aws_session_token your-session-token
處理Amazon S3上的檔案
範本:
code language-shell |
---|
|
範例:
code language-shell |
---|
|
範本:
code language-shell |
---|
|
範例:
code language-shell |
---|
|
使用您的Data Landing Zone認證登入AWS Console
擷取您的認證
首先,您必須取得下列內容:
awsAccessKeyId
awsSecretAccessKey
awsSessionToken
產生登入權杖
接下來,使用擷取的認證,建立工作階段並使用AWS Federation端點產生登入權杖:
import json
import requests
# Example DLZ response with credentials
response_json = '''{
"credentials": {
"awsAccessKeyId": "your-access-key",
"awsSecretAccessKey": "your-secret-key",
"awsSessionToken": "your-session-token"
}
}'''
# Parse credentials
response_data = json.loads(response_json)
aws_access_key_id = response_data['credentials']['awsAccessKeyId']
aws_secret_access_key = response_data['credentials']['awsSecretAccessKey']
aws_session_token = response_data['credentials']['awsSessionToken']
# Create session dictionary
session = {
'sessionId': aws_access_key_id,
'sessionKey': aws_secret_access_key,
'sessionToken': aws_session_token
}
# Generate the sign-in token
signin_token_url = "https://signin.aws.amazon.com/federation"
signin_token_payload = {
"Action": "getSigninToken",
"Session": json.dumps(session)
}
signin_token_response = requests.post(signin_token_url, data=signin_token_payload)
signin_token = signin_token_response.json()['SigninToken']
建構AWS主控台登入URL
取得登入權杖後,您就可以建置URL,將您登入AWS主控台,並直接指向所需的Amazon S3貯體。
from urllib.parse import quote
# Define the S3 bucket and folder path you want to access
bucket_name = "your-bucket-name"
bucket_path = "your-bucket-folder"
# Construct the destination URL
destination_url = f"https://s3.console.aws.amazon.com/s3/buckets/{bucket_name}?prefix={bucket_path}/&tab=objects"
# Create the final sign-in URL
signin_url = f"https://signin.aws.amazon.com/federation?Action=login&Issuer=YourAppName&Destination={quote(destination_url)}&SigninToken={signin_token}"
print(f"Sign-in URL: {signin_url}")
存取AWS Console
最後,導覽至產生的URL,以使用您的Data Landing Zone認證直接登入AWS Console,進而存取Amazon S3貯體中的特定資料夾。 登入URL會直接將您帶往該資料夾,確保您只會看見和管理允許的資料。
連線Data Landing Zone至Experience Platform
以下檔案提供如何使用API或使用者介面將資料從您的Data Landing Zone容器帶入Adobe Experience Platform的資訊。