Here is an example CloudFormation template for creating a QuickSight data source with a Redshift input parameter:
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
DataSourceId:
Type: String
RedshiftClusterId:
Type: String
Database:
Type: String
ClusterUsername:
Type: String
ClusterPassword:
Type: String
CredentialUsername:
Type: String
CredentialPassword:
Type: String
Federated:
Type: String
VpcConnectionArn:
Type: String
Resources:
MyDataSource:
Type: AWS::QuickSight::DataSource
Properties:
DataSourceId: !Ref DataSourceId
Name: MyDataSource
Type: REDSHIFT
DataSourceParameters:
RedshiftClusterId: !Ref RedshiftClusterId
Database: !Ref Database
ClusterUsername: !Ref ClusterUsername
ClusterPassword: !Ref ClusterPassword
Credentials:
CredentialPair:
Username: !Ref CredentialUsername
Password: !Ref CredentialPassword
Permissions:
- Principal:
Federated: !Ref Federated
Actions:
- "quicksight:DescribeDataSource"
- "quicksight:DescribeDataSourcePermissions"
- "quicksight:PassDataSource"
VpcConnectionProperties:
VpcConnectionArn: !Ref VpcConnectionArn
Outputs:
DataSourceId:
Value: !Ref DataSourceId
RedshiftClusterId:
Value: !Ref RedshiftClusterId
Database:
Value: !Ref Database
ClusterUsername:
Value: !Ref ClusterUsername
CredentialUsername:
Value: !Ref CredentialUsername
Federated:
Value: !Ref Federated
VpcConnectionArn:
Value: !Ref VpcConnectionArnThis template defines a resource of type AWS::QuickSight::DataSource with the following properties:
DataSourceId: The ID of the data source. This is a required parameter that you must specify when creating the data source.Name: The name of the data source.Type: The type of the data source. In this case, we are using a Redshift data source, so the type is set toREDSHIFT.DataSourceParameters: The parameters for the data source. In this case, we are specifying theRedshiftClusterId,Database,ClusterUsername, andClusterPasswordparameters for connecting to a Redshift cluster.Credentials: The credentials for accessing the data source. In this case, we are specifying aCredentialPairwith aUsernameandPassword.Permissions: The permissions for the data source. In this case, we are giving the specifiedPrincipal(a federated user or group) permissions toDescribeDataSource,DescribeDataSourcePermissions, andPassDataSourceon the data source.VPCConnectionProperties: The VPC connection properties for the data source. In this case, we are specifying theVpcConnectionArnto use for the connection.
To create a QuickSight data source with this template, you can use the aws cloudformation create-stack command and specify the template file as the input. You will also need to provide values for the parameters in the Parameters section of the template.
The template also defines a number of parameters that you must specify when creating the data source. These include the DataSourceId, RedshiftClusterId, Database, ClusterUsername, ClusterPassword, CredentialUsername, CredentialPassword, Federated, and VpcConnectionArn parameters.
The Outputs section defines a number of output values that can be referenced after the stack is created. In this case, the output values include the DataSourceId, RedshiftClusterId, Database, ClusterUsername, CredentialUsername, Federated, and VpcConnectionArn parameters that were used to create the data source.




