

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 在資料層中命名 Amazon S3 儲存貯體
<a name="naming-structure-data-layers"></a>

下列各節提供資料湖層中 Amazon Simple Storage Service (Amazon S3) 儲存貯體的命名結構。不過，您可以根據組織的需求自訂 Amazon S3 儲存貯體和路徑名稱。我們建議您為每個個別 layer 建立個別的儲存貯體，因為每個 layer 的封存、版本控制、存取和加密需求可能有所不同。

下圖顯示建議資料湖層中 Amazon S3 儲存貯體的建議命名結構。命名結構會分隔多個業務單位、檔案格式和分割區。



![命名方法會根據 S3 儲存貯體的預期資料層而有所不同。](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/images/data-lake-naming-diag-1.png)


**重要**  
Amazon S3 儲存貯體必須遵循 Amazon S3 文件中[儲存貯體命名規則的命名](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html)準則。

您可以根據組織的需求調整資料分割區。不過，您應該使用小寫和鍵值對 （例如，`year=yyyy`而不是 `yyyy`)，以便您可以使用 `MSCK REPAIR TABLE`命令更新目錄。

定義分割區策略取決於資料的性質，以及最重要的使用者查詢的性質。我們建議您分析耗用量和資料處理模式，以尋找最適合您組織的策略。一般而言，在原始資料層上提供較高的階層層級很合理，例如 `year=yyyy`、 `month=mm`和 `day=dd`，以及在耗用資料層上提供較低的階層層級，例如階段層和分析層。這是因為原始資料層通常沒有資料處理管道的複雜耗用模式。

## 登陸區域 Amazon S3 儲存貯體
<a name="landing-zone-naming-structure"></a>

如果敏感資料集包含在將資料移至原始儲存貯體之前必須遮罩的元素，則需要登陸區域的 Amazon S3 儲存貯體。

下表提供命名結構、命名結構的描述，以及登陸區域層中 Amazon S3 儲存貯體的名稱範例。


****  

| 命名格式 | 範例 | 
| --- | --- | 
| `s3://companyname-landingzoneawsregion-awsaccount\|uniqidenv/source/source_region/table/year=yyyy/month=mm/day=dd/table_<yearmonthday>.avro\|csv`[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html) | `s3://anycompany-landingzoneuseast1-12345-dev/socialmedia/us/tb_products/year=2021/month=03/day=01/products_20210301.csv` | 

## 原始層 Amazon S3 儲存貯體
<a name="raw-data-layer-naming-structure"></a>

原始資料層包含尚未轉換且為原始檔案格式的擷取資料，例如  JSON 或 CSV。此資料通常會依資料來源及其擷取至原始資料層 Amazon S3 儲存貯體的日期進行組織。

下表提供命名結構、命名結構的描述，以及原始資料層中 Amazon S3 儲存貯體的名稱範例。


****  

| 命名格式 | 範例 | 
| --- | --- | 
| `s3://companyname-raw-awsregion-awsaccount\|uniqid-env/source/source_region/table/year=yyyy/month=mm/day=dd/table_<yearmonthday>.avro\|csv`[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html) | `s3://anycompany-raw-useast1-12345-dev/socialmedia/us/tb_products/year=2021/month=03/day=01/products_20210301.csv` | 

## 階段層 Amazon S3 儲存貯體
<a name="stage-data-layer-naming-structure"></a>

階段層中的資料會從原始層讀取和轉換 （例如，使用 AWS Glue 或 Amazon EMR 任務）。此程序會驗證資料 （例如，透過檢查資料類型和標頭），然後將其存放在耗用就緒的檔案格式，例如 Apache Parquet。中繼資料存放在 的資料表中[AWS Glue Data Catalog](https://docs.aws.amazon.com/glue/latest/dg/components-overview.html)。

下表提供命名結構、命名結構的描述，以及階段資料層中 Amazon S3 儲存貯體的名稱範例。


****  

| 命名格式 | 範例 | 
| --- | --- | 
| `s3://companyname-stageawsregion-awsaccount\|uniqidenv/source/source_region/ business_unit/table/<partitions>/table_<table_name>_<yearmonthday>.snap`[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html) | `s3://anycompany-stagesaeast1-12345-dev/sap/br/customers/validated/dt=2021-03-01/table_customers_20210301.snappy.parquet py.parquet` | 

## Analytics layer Amazon S3 儲存貯體
<a name="analytics-data-layer-naming-structure"></a>

分析層類似於階段層，因為資料採用已處理的檔案格式，但資料接著會根據組織的需求進行彙總。

下表提供命名結構、命名結構的描述，以及分析資料層中 Amazon S3 儲存貯體的名稱範例。


****  

| 命名格式 | 範例 | 
| --- | --- | 
| `s3://companyname-analytics-awsregion-awsaccount\|uniqid-env/source_region/business_unit/tb_<region>_<table_name>_<file_format>/<partition_0>/<partition_1>/.../<partition_n>/xxxxx.<compression>.<file_format>`[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html)[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/defining-bucket-names-data-lakes/naming-structure-data-layers.html) | `s3://anycompany-analytics-useast1-12345-dev/us/sales/tb_us_customers_parquet/<partitions>/part-000001-20218c886790.c000.snappy.parquet` | 