How to connect to Athena datasource in cdk?

I have this code that gives me an error which seems to be on prop “type”:

const cfnDataSource = new quicksight.CfnDataSource(
      this,
      "MyCfnDataSource",
       {
        alternateDataSourceParameters: [
          {
            athenaParameters: {
              roleArn: athenaRole.roleArn,
              workGroup: "workGroupName",
            },
          },
        ],
        awsAccountId: `123456789`,
        dataSourceId: "dataSourceIdForAthena",
        name: "DynamoDBQuicksightDataSource",
        type: "ListDataSources",
      }
    );
Properties validation failed for resource MyCfnDataSource with message:
#/Type: #: only 1 subschema matches out of 2
#/Type: failed validation constraint for keyword [enum]

I used this and it worked: type: "ATHENA",
here is the list:

Allowed values: ADOBE_ANALYTICS | AMAZON_ELASTICSEARCH | AMAZON_OPENSEARCH | ATHENA | AURORA | AURORA_POSTGRESQL | AWS_IOT_ANALYTICS | DATABRICKS | GITHUB | JIRA | MARIADB | MYSQL | ORACLE | POSTGRESQL | PRESTO | REDSHIFT | S3 | SALESFORCE | SERVICENOW | SNOWFLAKE | SPARK | SQLSERVER | STARBURST | TERADATA | TIMESTREAM | TRINO | TWITTER

@japeter89
AWS::QuickSight::DataSource - AWS CloudFormation ( Type would be ATHENA )

An example of my JSON for athena datasource creation. RoleArn i think is optional.

{
“AwsAccountId”: “XXXXX”,
“DataSourceId”: “athena-custom-role”,
“Name”: “athena-custom-role”,
“Type”: “ATHENA”,
“DataSourceParameters”: {
“AthenaParameters”: {
“WorkGroup”: “primary”,
“RoleArn”: “arn:aws:iam::XXXXX:role/TestAthenaRoleForQuickSight”
}
},
“Permissions”: [
{
“Principal”: “arn:aws:quicksight:eu-central-1:XXXXX:user/default/Admin/abc”,
“Actions”: [
“quicksight:UpdateDataSourcePermissions”,
“quicksight:DescribeDataSourcePermissions”,
“quicksight:PassDataSource”,
“quicksight:DescribeDataSource”,
“quicksight:DeleteDataSource”,
“quicksight:UpdateDataSource”
]
}
]
}

Regards,
Koushik

1 Like

@Koushik_Muthanna - is permissions required? I noticed an error: The QuickSight service role required to access your AWS resources has not been created yet.
Could that be because of the permissions in the connection of datasource?