# Data & Analytics

<mark style="color:red;">**• Serverless q**</mark>**uery service to analyze data stored in&#x20;**<mark style="color:red;">**Amazon S3**</mark>&#x20;

**• Uses standard SQL language to query the files (built on Presto)**&#x20;

**• Supports CSV, JSON, ORC, Avro, and Parquet**&#x20;

**• Pricing: $5.00 per TB of data scanned**&#x20;

<mark style="color:green;">**• Commonly used with Amazon Quicksight for reporting/dashboards**</mark>&#x20;

<mark style="color:red;">**• Use cases:**</mark>**&#x20;Business intelligence / analytics / reporting, analyze & query VPC Flow Logs, ELB Logs,&#x20;**<mark style="color:red;">**CloudTrail trails**</mark>**, etc...**&#x20;

<mark style="color:red;">**• Exam Tip**</mark>**: analyze data in S3 using serverless SQL, use Athen**a

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FaX9M4Aik915R8PZU1d4o%2Fimage.png?alt=media&#x26;token=25afd3b5-1ed1-4252-8ac5-2e9b4b96e1a8" alt=""><figcaption></figcaption></figure>

## <mark style="color:blue;">Amazon Athena – Performance Improvement</mark>&#x20;

**• Use&#x20;**<mark style="color:red;">**columnar data**</mark>**&#x20;for cost-savings (less scan)**&#x20;

&#x20;     **• Apache Parquet or ORC is recommended**&#x20;

&#x20;     **• Huge performance improvement**&#x20;

&#x20;     **• Use Glue to convert your data your Parquet or ORC**&#x20;

#### **•&#x20;**<mark style="color:red;">**Compress data**</mark>**&#x20;for smaller retrievals (bzip2, gzip, lz4, snappy, zlip, zstd…)**&#x20;

#### <mark style="color:red;">**• Partition**</mark>**&#x20;datasets in S3 for easy querying on virtual columns**&#x20;

**• s3://yourBucket/pathToTable**&#x20;

**/\<PARTITION\_COLUMN\_NAME>=**&#x20;

**/\<PARTITION\_COLUMN\_NAME>=**&#x20;

**/\<PARTITION\_COLUMN\_NAME>= /etc…**&#x20;

**• Example: s3://athena-examples/flight/parquet/year=1991/month=1/day=1/**&#x20;

**•&#x20;**<mark style="color:red;">**Use larger files**</mark>**&#x20;(> 128 MB) to minimize overhead**

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FUDbrW3SpoCmJqbfhre3q%2Fimage.png?alt=media&#x26;token=c8499dca-f975-4500-abbd-47379456b741" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2Fv2uT39tPqRrVvxszTHE2%2Fimage.png?alt=media&#x26;token=7b6a0907-35a3-4137-853d-0dfbebacd682" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FyUL0VKfUygtnFUv86Ag1%2Fimage.png?alt=media&#x26;token=1df2892b-a3f3-4ada-b0a4-3c455d994c51" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FpVzj5ks2deLuGks7W7WC%2Fimage.png?alt=media&#x26;token=5abad871-b556-4bd3-a525-e29716f2bd76" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2Fv4ol9zeTjKmKSd5ygWNC%2Fimage.png?alt=media&#x26;token=2b63749e-fb26-47c9-aa71-ed1fab4a3af7" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2Fm1P4X6oqBEZXMK90GgRV%2Fimage.png?alt=media&#x26;token=35e098cc-c986-48d5-978e-e709b85eaa44" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FPC2bxMZKY7Mg9b2Ykn28%2Fimage.png?alt=media&#x26;token=5168f5c3-5dff-4eef-b77c-27f0f93852e2" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2Fe6TjjnmjgXTSaZUohKgk%2Fimage.png?alt=media&#x26;token=4b9b83a7-75bd-445c-881d-de2db1255a20" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2Fq6ZQpTdwW5yplPaM24Sh%2Fimage.png?alt=media&#x26;token=949bc668-c322-47fd-ab89-c049eea204a1" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FhNCbtbMHmglZSzCHuMmB%2Fimage.png?alt=media&#x26;token=611fd9ab-87d7-4531-8b21-6305960cee21" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FGBVcmlaO7k2Q2N4XnKyz%2Fimage.png?alt=media&#x26;token=2a7e700f-c3eb-4b6d-82b3-af6b34816d70" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2Fwv94Vjq3bCa69Ie0QIo1%2Fimage.png?alt=media&#x26;token=3ea3b499-1184-4b53-8bce-0147967a57bf" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FmuVsHMqCqrJG4nSKoxVT%2Fimage.png?alt=media&#x26;token=5f54199c-8933-4f1d-9c14-fc197f38116e" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2Fs1aL4T4ta3VrZd4mZ7MR%2Fimage.png?alt=media&#x26;token=ae1b30ee-0996-436d-aa7a-be246b60c910" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FPnVdBKSRP3MvKmNtyiTO%2Fimage.png?alt=media&#x26;token=519381ec-b624-4d64-a2c9-3f968c5881c4" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2Fb4vuvFJ2Y2xYnke4fLY9%2Fimage.png?alt=media&#x26;token=1a1676f6-2c6c-4ec0-8102-908755844b89" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FvuBGRhaLO6qNlzfmaV9f%2Fimage.png?alt=media&#x26;token=736addbd-51e7-4e88-a2da-312d59fd1000" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2F1np73EKjWkirLSC77uYf%2Fimage.png?alt=media&#x26;token=edbea87b-c13e-4258-a5e6-bf37cc5f90b5" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FzaB4zy79l6s32phXVpX3%2Fimage.png?alt=media&#x26;token=b77b2ff0-d8b8-4382-b742-beccf3b5cc3f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FgviTKRz9qt9rN8bqu98z%2Fimage.png?alt=media&#x26;token=bd8e1de5-28a0-449e-9c84-5bd087bf4c8f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FS0Je21l0J7gHlHaKmM4I%2Fimage.png?alt=media&#x26;token=e99a1212-8b21-401e-aa05-801ee6053672" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FyT8kuaU72Jjl38GZBqda%2Fimage.png?alt=media&#x26;token=a31179fe-48b7-4766-b0f4-195008b49330" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2Fn4ueeR96JtAenGwESorR%2Fimage.png?alt=media&#x26;token=ffac3b70-f1b7-485b-bb3f-bcb68be43137" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FgbNCGEd7btEuU4DBVUAX%2Fimage.png?alt=media&#x26;token=3b0a7996-d3a8-4bb7-ab0a-26ab53ae73f3" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FTb5gJC7q39KSHrHaYptF%2Fimage.png?alt=media&#x26;token=408875e6-4051-4848-a0e4-9a68ceb2876f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FySEUmvpdSVZbt06H4noH%2Fimage.png?alt=media&#x26;token=733b206d-a087-40d7-a1bb-68efe0ab89b9" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FPs9KrMUtn01TykXgMsth%2Fimage.png?alt=media&#x26;token=53052cd4-b576-4ceb-ab0e-4c5330a794d2" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2Fivq9JFLuqJmORHNhnXR0%2Fimage.png?alt=media&#x26;token=77fbcd5f-57d8-4f12-9135-7f3dacfcd8f2" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FEmOct6s99m0OCMKxZw75%2Fimage.png?alt=media&#x26;token=f1e3c309-9f91-439f-b9b8-30c15c1c6212" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FWqIBtJHKkZVtrgreRJU3%2Fimage.png?alt=media&#x26;token=d71b9491-54ea-4dca-9bb3-82243ce01880" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2F31oJgic9UcZ7zxkBiovS%2Fimage.png?alt=media&#x26;token=6dcc3ca1-f362-4530-8357-51ee5ab48d74" alt=""><figcaption></figcaption></figure>

<figure><img src="https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2F94Z7dZtaw29aNv7lJ1DZ%2Fimage.png?alt=media&#x26;token=325a9f7c-eba4-4c37-8389-cea64f7a97f6" alt=""><figcaption></figcaption></figure>
