-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat(typescript/quicksight): Add an example that creates a useable dataset in Quicksight #1085
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
4af6685
Initial quicksight example commit
SGhotra1 cbb0282
Used world population data, created logical columns, refactored namin…
SGhotra1 75392c9
refactor: improving naming and sorting the code
8fecbe2
fix: re-add deployment to dependencies of the quicksight data source
c4adb17
refactor: cleanup imports
3aa7f1d
refactor: quicksight datasource name moved to a static property
e3b4353
refactor: policy generation and cleanup
8723558
refactor: naming of definitions for the quicksight table
c2f446d
refactor: move dataset name to a static
fbbb7b3
docs: add instructions
54b5652
refactor: Fixed some links for Cloudformation resources docs, quicksi…
SGhotra1 b3c3862
docs: a tad more info in the readme
1fcb98e
chore: readme updated
KathiHae 535f1e5
chore: add resources information
carreque 8a9b4d9
docs: Added explanation of the quicksight arn, removed test scripts
SGhotra1 8fb0be1
Merge branch 'main' into ts-quicksight-example
sebs 67ba656
chore: Add DO_NOT_AUTOTEST file
SGhotra1 92b1a25
Merge branch 'main' into ts-quicksight-example
SGhotra1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| <!--BEGIN STABILITY BANNER--> | ||
| --- | ||
|
|
||
|  | ||
|
|
||
| > **This is an experimental example. It may not build out of the box** | ||
| > | ||
| > This example is built on Cfn resources. | ||
| > | ||
| > It requires additional infrastructure prerequisites that must be created before successful build, see below. | ||
| > | ||
| > If build is unsuccessful, please create an [issue](https://github.com/aws-samples/aws-cdk-examples/issues/new) so that we may debug the problem | ||
| --- | ||
| <!--END STABILITY BANNER--> | ||
|
|
||
| ## Overview | ||
|
|
||
| This project demonstrates how to set up Amazon Quicksight. It will set up a S3 Bucket, import some test data and makes it available as a datasource to quicksight. | ||
|
|
||
| With this setup you can create analysis in the console to view e.g. the world-population data: | ||
| world-population.csv file in data directory taken from https://data.worldbank.org/indicator/SP.POP.TOTL | ||
| License: CC BY-4.0 | ||
|
|
||
| ## Build | ||
|
|
||
| To build this app, you need to be in this example's root folder. Then run the following: | ||
|
|
||
| ```bash | ||
| npm install -g aws-cdk | ||
| npm install | ||
| npm run build | ||
| ``` | ||
|
|
||
| ## Resources | ||
|
|
||
| 1. * `Bucket` (aws-s3): Creates an Amazon S3 bucket with encryption and full access control, used to store data files and the manifest for QuickSight. | ||
| 2. * `BucketDeployment` (aws-s3-deployment): Deploys world population data and manifest JSON files to the S3 bucket, making them accessible for analysis in QuickSight. | ||
| 3. * `CfnDataSource` (aws-quicksight): Defines an Amazon QuickSight data source that connects to the S3 bucket to access the uploaded CSV files. | ||
| 4. * `CfnDataSet` (aws-quicksight): Configures a QuickSight dataset that organizes and structures the CSV data from the S3 bucket for reporting and analysis. | ||
| 5. * `CfnManagedPolicy` (aws-iam): Creates an IAM policy granting permissions to the QuickSight service role, allowing access to the S3 bucket and other necessary actions. | ||
|
|
||
| ## Deploy | ||
|
|
||
| 1. Create a quicksight account [by following these instructions](https://docs.aws.amazon.com/quicksight/latest/user/signing-up.html). | ||
| 2. Use the arn of the quicksight account and pass it to cdk using a context `cdk deploy --context quicksightAccountArn=<arn>` | ||
|
|
||
| The Quicksight account arn should look like this 'arn:aws:quicksight:\<region>:\<accountid>:user/\<namespace>/\<username>' | ||
|
|
||
| #### \<region> | ||
| The aws region that contains the quicksight resources. | ||
| #### \<accountid> | ||
| This is your AWS account id. | ||
| #### \<namespace> | ||
| You can create a separate namespace, but if you haven't created one it should be 'default'. | ||
| #### \<username> | ||
| You can find the username in Quicksight. It should be the same as your IAM Account name | ||
| and if you are using a role it will be added to the name as well like: \<role>/\<username> | ||
|
|
||
| ## Useful commands | ||
|
|
||
| * `npm run build` compile typescript to js | ||
| * `npm run watch` watch for changes and compile | ||
| * `npm run test` perform the jest unit tests | ||
| * `npx cdk deploy` deploy this stack to your default AWS account/region | ||
| * `npx cdk diff` compare deployed stack with current state | ||
| * `npx cdk synth` emits the synthesized CloudFormation template | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #!/usr/bin/env node | ||
| import 'source-map-support/register'; | ||
| import * as cdk from 'aws-cdk-lib'; | ||
| import { QuicksightExampleStack } from '../lib/quicksight-example-stack'; | ||
|
|
||
| const app = new cdk.App(); | ||
|
|
||
| // Quicksight account arn should look like this 'arn:aws:quicksight:<region>:<accountid>:user/<namespace>/<username>' | ||
| const quicksightExampleProps = {quicksightAccountArn: app.node.tryGetContext('quicksightAccountArn')}; | ||
| if (quicksightExampleProps.quicksightAccountArn == null) { | ||
| console.log('quicksightAccountArn is empty! Please provide it via the cdk context'); | ||
| process.exit(1); | ||
| } | ||
| new QuicksightExampleStack(app, 'QuicksightExampleStack', quicksightExampleProps); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| { | ||
| "app": "npx ts-node --prefer-ts-exts bin/quicksight-example.ts", | ||
| "watch": { | ||
| "include": [ | ||
| "**" | ||
| ], | ||
| "exclude": [ | ||
| "README.md", | ||
| "cdk*.json", | ||
| "**/*.d.ts", | ||
| "**/*.js", | ||
| "tsconfig.json", | ||
| "package*.json", | ||
| "yarn.lock", | ||
| "node_modules", | ||
| "test" | ||
| ] | ||
| }, | ||
| "context": { | ||
| "@aws-cdk/aws-lambda:recognizeLayerVersion": true, | ||
| "@aws-cdk/core:checkSecretUsage": true, | ||
| "@aws-cdk/core:target-partitions": [ | ||
| "aws", | ||
| "aws-cn" | ||
| ], | ||
| "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true, | ||
| "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true, | ||
| "@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true, | ||
| "@aws-cdk/aws-iam:minimizePolicies": true, | ||
| "@aws-cdk/core:validateSnapshotRemovalPolicy": true, | ||
| "@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true, | ||
| "@aws-cdk/aws-s3:createDefaultLoggingPolicy": true, | ||
| "@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true, | ||
| "@aws-cdk/aws-apigateway:disableCloudWatchRole": true, | ||
| "@aws-cdk/core:enablePartitionLiterals": true, | ||
| "@aws-cdk/aws-events:eventsTargetQueueSameAccount": true, | ||
| "@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true, | ||
| "@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName": true, | ||
| "@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": true, | ||
| "@aws-cdk/aws-route53-patters:useCertificate": true, | ||
| "@aws-cdk/customresources:installLatestAwsSdkDefault": false, | ||
| "@aws-cdk/aws-rds:databaseProxyUniqueResourceName": true, | ||
| "@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup": true, | ||
| "@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": true, | ||
| "@aws-cdk/aws-ec2:launchTemplateDefaultUserData": true, | ||
| "@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": true, | ||
| "@aws-cdk/aws-redshift:columnId": true, | ||
| "@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2": true, | ||
| "@aws-cdk/aws-ec2:restrictDefaultSecurityGroup": true, | ||
| "@aws-cdk/aws-apigateway:requestValidatorUniqueId": true, | ||
| "@aws-cdk/aws-kms:aliasNameRef": true, | ||
| "@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig": true, | ||
| "@aws-cdk/core:includePrefixInUniqueNameGeneration": true, | ||
| "@aws-cdk/aws-efs:denyAnonymousAccess": true, | ||
| "@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby": true, | ||
| "@aws-cdk/aws-lambda-nodejs:useLatestRuntimeVersion": true, | ||
| "@aws-cdk/aws-efs:mountTargetOrderInsensitiveLogicalId": true, | ||
| "@aws-cdk/aws-rds:auroraClusterChangeScopeOfInstanceParameterGroupWithEachParameters": true, | ||
| "@aws-cdk/aws-appsync:useArnForSourceApiAssociationIdentifier": true, | ||
| "@aws-cdk/aws-rds:preventRenderingDeprecatedCredentials": true, | ||
| "@aws-cdk/aws-codepipeline-actions:useNewDefaultBranchForCodeCommitSource": true, | ||
| "@aws-cdk/aws-cloudwatch-actions:changeLambdaPermissionLogicalIdForLambdaAction": true, | ||
| "@aws-cdk/aws-codepipeline:crossAccountKeysDefaultValueToFalse": true, | ||
| "@aws-cdk/aws-codepipeline:defaultPipelineTypeToV2": true, | ||
| "@aws-cdk/aws-kms:reduceCrossAccountRegionPolicyScope": true, | ||
| "@aws-cdk/aws-eks:nodegroupNameAttribute": true, | ||
| "@aws-cdk/aws-ec2:ebsDefaultGp3Volume": true, | ||
| "@aws-cdk/aws-ecs:removeDefaultDeploymentAlarm": true, | ||
| "@aws-cdk/custom-resources:logApiResponseDataPropertyTrueDefault": false, | ||
| "@aws-cdk/aws-s3:keepNotificationInImportedBucket": false | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.