

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

# 雲端前端 3
<a name="aws-cloudfront-s3"></a>

![](https://docs.aws.amazon.com/zh_tw/solutions/latest/constructs/images/experimental.png)


 所有類都在積極開發中，並且在任何未來版本中都會受到非向後兼容的更改或刪除。這些不受[語義版本](https://semver.org/)模式。這意味著，雖然您可以使用它們，但在升級到此軟件包的較新版本時，您可能需要更新源代碼。

**請注意：** 為了確保功能正確，專案中的 AWS 解決方案建構套件和 AWS CDK 套件必須是相同的版本。


|  **語言**  |  **套件**  | 
| --- | --- | 
|  ![](https://docs.aws.amazon.com/zh_tw/solutions/latest/constructs/images/python.png) Python  |  aws\_solutions\_constructs.aws\_cloudfront\_s3  | 
|  ![](https://docs.aws.amazon.com/zh_tw/solutions/latest/constructs/images/typescript.png) TypeScript  |  @aws-solutions-constructs/aws-cloudfront-s3  | 
|  ![](https://docs.aws.amazon.com/zh_tw/solutions/latest/constructs/images/java.png) Java  |  software.amazon.awsconstructs.services.cloudfronts3  | 

## Overview
<a name="overview-5"></a>

 AWS 解決方案建構會在 Amazon S3 儲存貯體前實作 Amazon CloudFront 散發。

 下面是 TypeScript 中的最小可部署模式定義：

```
import { CloudFrontToS3 } from '@aws-solutions-constructs/aws-cloudfront-s3';

new CloudFrontToS3(this, 'test-cloudfront-s3', {});
```

## Initializer
<a name="initializer-5"></a>

```
new CloudFrontToS3(scope: Construct, id: string, props: CloudFrontToS3Props);
```

 *參數* 
+  scope[`Construct`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_core.Construct.html) 
+  id`string` 
+  提案[`CloudFrontToS3Props`](#pattern-construct-props-5) 

## 模式建立道具
<a name="pattern-construct-props-5"></a>


|  **名稱**  |  **類型**  |  **描述**  | 
| --- | --- | --- | 
|  現在的巴克托比？  |  [`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.Bucket.html)  |  S3 桶對象的現有實例。如果這是提供的，那麼還提供bucketProps是錯誤。 | 
|  水桶道具？  |  [`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.BucketProps.html)  |  可選的使用者提供的屬性來覆寫儲存貯體的預設屬性。忽略existingBucketObj提供。 | 
|  雲端發佈道具？  |  [`cloudfront.DistributionProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudfront.DistributionProps.html)  |  可選的使用者提供的道具，以覆寫 CloudFront 分發的預設道具。 | 
|  插入安全性標頭？  |  boolean  |  可選的用戶提供的道具，用於在 CloudFront 的所有響應中打開/關閉最佳實踐 HTTP 安全標頭的自動注入  | 

## 模式性質
<a name="pattern-properties-5"></a>


|  **名稱**  |  **類型**  |  **描述**  | 
| --- | --- | --- | 
|  雲端網絡發佈  |  [`cloudfront.CloudFrontWebDistribution`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudfront.CloudFrontWebDistribution.html)  |  返回由模式創建的 CloudFront 網絡分發的實例。 | 
|  S3 儲存貯體？  |  [`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.Bucket.html)  |  返回由模式創建的 S3 存儲桶的實例。 | 
|  S3 記錄桶？  |  [`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.Bucket.html)  |  返回由 S3 存儲桶模式創建的日誌存儲桶的實例。 | 
|  埃德格拉姆針灸版本？  |  [`lambda.Version`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Version.html)  |  返回由模式創建的 Lambda 邊緣函數版本的實例。 | 
|  雲端記錄桶？  |  [`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.Bucket.html)  |  傳回 CloudFront 網頁分發模式所建立之記錄儲存貯體的執行個體。 | 

## 預設設定
<a name="default-settings-5"></a>

 此模式的開箱即用實現沒有任何覆蓋將設置以下默認值：

### Amazon CloudFront
<a name="amazon-cloudfront-2"></a>
+  設定 CloudFront 網路發佈的存取記錄 
+  在 CloudFront 網路發佈的所有回應中啟用自動插入最佳實務 HTTP 安全性標頭 

### Amazon S3 儲存貯體
<a name="amazon-s3-bucket"></a>
+  設定 S3 儲存貯體的存取記錄 
+  使用 AWS 受管 KMS 金鑰啟用 S3 儲存貯體的伺服器端加密 
+  打開 S3 存儲桶的版本控制 
+  不允許公開存取 S3 儲存貯體 
+  刪除 CloudFormation 堆疊時保留 S3 桶 
+  強制加密傳輸中的資料 
+  套用生命週期規則，在 90 天後將非目前物件版本移至 Glacier 儲存區 

## Architecture
<a name="architecture-5"></a>

![](https://docs.aws.amazon.com/zh_tw/solutions/latest/constructs/images/aws-cloudfront-s3.png)


## GitHub
<a name="github-5"></a>


<table>
<thead>
  <tr><th colspan="2"> <b>要查看此模式的代碼，創建/查看問題和提取請求，以及更多：</b> </th></tr>
</thead>
<tbody>
  <tr><td> <img src="https://docs.aws.amazon.com/zh_tw/solutions/latest/constructs/images/GitHub-Mark-32px.png" alt="" /> </td><td> <a href="https://github.com/awslabs/aws-solutions-constructs/tree/master/source/patterns/%40aws-solutions-constructs/aws-cloudfront-s3">@aws-解決方案結構/aws-雲前面 3</a> </td></tr>
</tbody>
</table>
