

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

# 使用 Athena 分析存放在 Amazon S3 中的 Amazon SNS 訊息 Amazon S3
<a name="firehose-message-analysis-s3"></a>

此頁面說明如何分析透過交付串流傳送至 Amazon Simple Storage Service (Amazon S3) 目的地的 Amazon SNS 訊息。Amazon S3

**分析透過 Firehose 交付串流傳送至 Amazon S3 目的地的 SNS 訊息**

1. 設定您的 Amazon S3 資源。如需指示，請參閱《*Amazon Simple Storage Service 使用者指南*》中的[建立儲存貯體](https://docs.aws.amazon.com/AmazonS3/latest/userguide/CreatingABucket.html)和《*Amazon Simple Storage Service 使用者指南*》中的[使用 Amazon S3 儲存貯體](https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingBucket.html)。

1. 設定交付串流。如需說明，請參閱[《Amazon Data Firehose 開發人員指南》中的為您的目的地選擇 Amazon S3](https://docs.aws.amazon.com/firehose/latest/dev/create-destination.html#create-destination-s3)。 **

1. 使用 [Amazon Athena](https://console.aws.amazon.com/athena) 查詢使用標準 SQL 的 Amazon S3 物件。如需詳細資訊，請參閱 *Amazon Athena 使用者指南*中的[入門](https://docs.aws.amazon.com/athena/latest/ug/getting-started.html)。

## 查詢範例
<a name="example-s3-query"></a>

在本範例查詢中，假設下列情況：
+ 訊息會儲存在 `default` 結構描述的 `notifications` 表格。
+ 所以此 `notifications` 表格包含具有 `string` 類型的 `timestamp` 欄位。

下列查詢會傳回在指定日期範圍內收到的所有 SNS 訊息：

```
SELECT * 
FROM default.notifications
WHERE from_iso8601_timestamp(timestamp) BETWEEN TIMESTAMP '2020-12-01 00:00:00' AND TIMESTAMP '2020-12-02 00:00:00';
```