How to create AWS QuickSight DataSource with AWS CLI

Here are the AWS CLI commands to create a QuickSight data source:

1- First, create a JSON file with the input parameters for the create-data-source command. For example, if you want to create a Redshift data source, the JSON file might look like this:

{
  "DataSourceId": "my-data-source-id",
  "Name": "MyDataSource",
  "Type": "REDSHIFT",
  "DataSourceParameters": {
    "RedshiftClusterId": "my-redshift-cluster-id",
    "Database": "mydatabase",
    "ClusterUsername": "myusername",
    "ClusterPassword": "mypassword"
  },
  "Credentials": {
    "CredentialPair": {
      "Username": "my-credential-username",
      "Password": "my-credential-password"
    }
  },
  "Permissions": [
    {
      "Principal": {
        "Federated": "arn:aws:iam::1234567890:federated-user/myuser"
      },
      "Actions": [
        "quicksight:DescribeDataSource",
        "quicksight:DescribeDataSourcePermissions",
        "quicksight:PassDataSource"
      ]
    }
  ],
  "VpcConnectionProperties": {
    "VpcConnectionArn": "arn:aws:quicksight:us-east-1:1234567890:vpc-connection/my-vpc-connection"
  }
}

2- Save the JSON file as a variable, such as $data_source_params.

3- Run the create-data-source command, passing in the $data_source_params variable as the input:

aws quicksight create-data-source --aws-account-id 1234567890 --namespace default --parameters "$data_source_params"

This will create a QuickSight data source with the specified parameters. The create-data-source command returns the ID of the newly created data source. You can use this ID to reference the data source in other QuickSight operations.

Note: The create-data-source command requires you to specify the AWS account ID and the namespace where the data source will be created. Make sure to replace the placeholder values in the example command with the actual values for your account and namespace.

ALSO READ  AWS CLI script that creates an AWS Lambda function:

Abhay Singh

I'm Abhay Singh, an Architect with 9 Years of It experience. AWS Certified Solutions Architect.

More Reading

Post navigation

Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *