{ "cells": [ { "cell_type": "markdown", "id": "721b4617", "metadata": {}, "source": [ "# Amazon QuickSight 구축하기\n", "--------------" ] }, { "cell_type": "markdown", "id": "ffc56a3e", "metadata": {}, "source": [ "### 1. QuickSight 생성하기\n", "\n", "AWS 콘솔에서 QuickSight 서비스를 생성합니다. 기본 설정에서 하단의 continue 버튼을 클릭합니다.\n", "

\n", "

\"\"
\n", "

\n", "

\n", " \n", "- Region은 편의성을 위해 현재 사용 중인 리전을 선택합니다. \n", "- 다음 Account Name은 unique한 이름으로 설정합니다. \n", "- 이메일 주소를 넣습니다.\n", "- Amazon S3를 선택한 다음 default_bucket 버킷명을 찾아서 선택하고 Finish 버튼을 클릭합니다." ] }, { "cell_type": "code", "execution_count": null, "id": "c2a99376", "metadata": {}, "outputs": [], "source": [ "import boto3\n", "import json" ] }, { "cell_type": "code", "execution_count": null, "id": "8edf9f94", "metadata": {}, "outputs": [], "source": [ "session = boto3.Session()\n", "s3 = session.client(service_name=\"s3\")" ] }, { "cell_type": "code", "execution_count": null, "id": "868b01da", "metadata": {}, "outputs": [], "source": [ "%store -r\n", "%store" ] }, { "cell_type": "code", "execution_count": null, "id": "faec81a0", "metadata": {}, "outputs": [], "source": [ "print(bucket)" ] }, { "cell_type": "code", "execution_count": null, "id": "0aff5dfd", "metadata": {}, "outputs": [], "source": [ "sts_client = boto3.client(\"sts\")\n", "account_id = sts_client.get_caller_identity()['Account']" ] }, { "cell_type": "code", "execution_count": null, "id": "f1241be1", "metadata": {}, "outputs": [], "source": [ "iam_client = boto3.client('iam')" ] }, { "cell_type": "code", "execution_count": null, "id": "17a50e97", "metadata": {}, "outputs": [], "source": [ "RoleName = f'TeamRole'\n", "\n", "iam_client.attach_role_policy(\n", " RoleName=RoleName,\n", " PolicyArn='arn:aws:iam::aws:policy/AmazonS3FullAccess'\n", ")\n", "iam_client.attach_role_policy(\n", " RoleName=RoleName,\n", " PolicyArn='arn:aws:iam::aws:policy/AdministratorAccess'\n", ")" ] }, { "cell_type": "markdown", "id": "d58366c6", "metadata": {}, "source": [ " \n", "

\n", "

\"\"
\n", "

\n", "

\n", "\n", " " ] }, { "cell_type": "markdown", "id": "afc1bfdc", "metadata": {}, "source": [ "### 8. QuickSight에서 사용할 manifest_file 생성하기\n", "\n", "quicksight에서 사용할 manifest_file 생성합니다." ] }, { "cell_type": "code", "execution_count": null, "id": "27447947", "metadata": {}, "outputs": [], "source": [ "manifest_file = {\n", " \"fileLocations\": [\n", " {\n", " \"URIPrefixes\": [\n", " f\"s3://{bucket}/amzforecast/results/results_clean.csv\"\n", " ]\n", " }\n", " ],\n", " \"globalUploadSettings\": {\n", " \"format\": \"CSV\",\n", " \"delimiter\": \",\",\n", " \"textqualifier\": \"\\\"\",\n", " \"containsHeader\": \"true\"\n", " }\n", " }" ] }, { "cell_type": "code", "execution_count": null, "id": "5e2ad495", "metadata": {}, "outputs": [], "source": [ "!mkdir ./quicksight" ] }, { "cell_type": "code", "execution_count": null, "id": "d65e2a8d", "metadata": {}, "outputs": [], "source": [ "with open(\"./quicksight/manifest_file.json\", 'w', encoding=\"utf-8\") as f:\n", " json.dump(manifest_file, f, indent=\"\\t\")" ] }, { "cell_type": "markdown", "id": "76f261d4", "metadata": {}, "source": [ " \n", "왼쪽 메뉴에서 **Datasets**를 선택한 다음 오른쪽 상단의 **New dataset**을 선택합니다. 이후 **S3**를 선택하면 아래와 같이 팝업 창이 뜨고, 원하는 이름으로 **data source name**을 설정한 다음, **upload a manifest file**에는 위에 copy한 S3 주소를 입력합니다." ] }, { "cell_type": "code", "execution_count": null, "id": "6a39734f", "metadata": {}, "outputs": [], "source": [ "!aws s3 cp ./quicksight/manifest_file.json s3://$bucket/quicksight/ --quiet\n", "print(f\"s3://{bucket}/quicksight/manifest_file.json\")" ] }, { "cell_type": "markdown", "id": "136e9298", "metadata": {}, "source": [ "

\n", "

\"\"
\n", "

\n", "

" ] }, { "cell_type": "markdown", "id": "e3ddc9bd", "metadata": {}, "source": [ "앞에서 생성한 dataset에서 **visualize**를 선택하면 아래와 같이 그래프 생성이 가능합니다." ] }, { "cell_type": "markdown", "id": "f37f06dd", "metadata": {}, "source": [ "

\n", "

\"\"
\n", "

\n", "

" ] }, { "cell_type": "markdown", "id": "1ad2d8e9", "metadata": {}, "source": [ "QuickSight에 관련된 자세한 실습은 [QuickSight Workshop](https://learnquicksight.workshop.aws/en/author-workshop/0.prerequisites.html) 에서 수행해 보시기 바랍니다." ] } ], "metadata": { "kernelspec": { "display_name": "conda_pytorch_p38", "language": "python", "name": "conda_pytorch_p38" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.12" } }, "nbformat": 4, "nbformat_minor": 5 }