|
1 |
| -# cloudformation-snowflake-resource-providers |
2 |
| -SnowFlake CFN Registry resource |
| 1 | +# Snowflake CloudFormation Resource Types |
| 2 | + |
| 3 | +This collection of [AWS CloudFormation resource types][1] allow Snowflake to be controlled using [AWS CloudFormation][2]. |
| 4 | + |
| 5 | +| Resource | Description | Documentation | |
| 6 | +|-------------------------------|--------------------------------------------------------------|------------------------------------| |
| 7 | +| Snowflake::Database::Database | This resource type manages a [Snowflake Database][10] | [/Snowflake-Database-Database][11] | |
| 8 | +| Snowflake::Database::Grant | This resource type manages a [Snowflake Database Grant][12] | [/Snowflake-Database-Grant][13] | |
| 9 | +| Snowflake::Role::Grant | This resource type manages a [Snowflake Role Grant][14] | [/Snowflake-Role-Grant][15] | |
| 10 | +| Snowflake::Role::Role | This resource type manages a [Snowflake Role][16] | [/Snowflake-Role-Role][17] | |
| 11 | +| Snowflake::User::User | This resource type manages a [Snowflake User][18] | [/Snowflake-User-User][19] | |
| 12 | +| Snowflake::Warehouse::Grant | This resource type manages a [Snowflake Warehouse Grant][20] | [/Snowflake-Warehouse-Grant][21] | |
| 13 | + |
| 14 | +## Prerequisites |
| 15 | +* [AWS Account][3] |
| 16 | +* [AWS CLI][4] |
| 17 | +* [Snowflake account][22] |
| 18 | + |
| 19 | +## AWS Management Console |
| 20 | + |
| 21 | +To get started: |
| 22 | + |
| 23 | +1. Sign in to the [AWS Management Console][5] with your account and navigate to CloudFormation. |
| 24 | + |
| 25 | +2. Select "Public extensions" from the left hand pane and filter Publisher by "Third Party". |
| 26 | + |
| 27 | +3. Use the search bar to filter by the "Snowflake" prefix. |
| 28 | + |
| 29 | +Note: All official Snowflake resources begin with `Snowflake::` and specify that they are `Published by Snowflake`. |
| 30 | + |
| 31 | +4. Select the desired resource name to view more information about its schema, and click **Activate**. |
| 32 | + |
| 33 | +5. On the **Extension details** page, specify: |
| 34 | +- Extension name |
| 35 | +- Execution role ARN |
| 36 | +- Automatic updates for minor version releases |
| 37 | +- Configuration |
| 38 | + |
| 39 | +6. In your terminal, specify the configuration data for the registered Snowflake CloudFormation resource type, in the given account and region by using the **SetTypeConfiguration** operation: |
| 40 | + |
| 41 | +For example: |
| 42 | + |
| 43 | + ```Bash |
| 44 | + $ aws cloudformation set-type-configuration \ |
| 45 | + --region us-west-2 --type RESOURCE \ |
| 46 | + --type-name Snowflake::Database::Database \ |
| 47 | + --configuration-alias default \ |
| 48 | + --configuration "{ \"SnowflakeAccess\":{\"Account\":\"YOURACCOUNT\", \"Username\":\"YOURUSERNAME\", \"Password\":\"YOURPASSWORD\"}}" |
| 49 | + ``` |
| 50 | + |
| 51 | +Note: All Snowflake resources requires a type configuration to be set, except `Snowflake::Database::Database`. |
| 52 | + |
| 53 | +7. After you have your resource configured, [create your AWS stack][6] that includes any of the activated Snowflake resources. |
| 54 | + |
| 55 | +For more information about available commands and workflows, see the official [AWS documentation][7]. |
| 56 | + |
| 57 | +## Supported regions |
| 58 | + |
| 59 | +The Snowflake CloudFormation resources are available on the CloudFormation Public Registry in the following regions: |
| 60 | + |
| 61 | +| Code | Name | |
| 62 | +|-----------------|---------------------------| |
| 63 | +| us-east-1 | US East (N. Virginia) | |
| 64 | +| us-east-2 | US East (Ohio) | |
| 65 | +| us-west-1 | US West (N. California) | |
| 66 | +| us-west-2 | US West (Oregon) | |
| 67 | +| ap-south-1 | Asia Pacific (Mumbai) | |
| 68 | +| ap-northeast-1 | Asia Pacific (Tokyo) | |
| 69 | +| ap-northeast-2 | Asia Pacific (Seoul) | |
| 70 | +| ap-southeast-1 | Asia Pacific (Singapore) | |
| 71 | +| ap-southeast-2 | Asia Pacific (Sydney) | |
| 72 | +| ca-central-1 | Canada (Central) | |
| 73 | +| eu-central-1 | Europe (Frankfurt) | |
| 74 | +| eu-west-1 | Europe (Ireland) | |
| 75 | +| eu-west-2 | Europe (London) | |
| 76 | +| eu-west-3 | Europe (Paris) | |
| 77 | +| eu-north-1 | Europe (Stockholm) | |
| 78 | +| sa-east-1 | South America (São Paulo) | |
| 79 | + |
| 80 | +**Note**: To privately register a resource in any other region, use the provided packages. |
| 81 | + |
| 82 | +## Examples |
| 83 | + |
| 84 | +### Shows how to create a Database in Snowflake |
| 85 | +```yaml |
| 86 | +--- |
| 87 | +AWSTemplateFormatVersion: '2010-09-09' |
| 88 | +Description: Shows how to create a Database in Snowflake |
| 89 | +Resources: |
| 90 | + NewDatabase: |
| 91 | + Type: Snowflake::Database::Database |
| 92 | + Properties: |
| 93 | + Name: ExampleDatabase |
| 94 | + DataRetentionTimeInDays: 1 |
| 95 | + MaxDataExtensionTimeInDays: 1 |
| 96 | + DefaultDdlCollation: "en-ci" |
| 97 | + Comment: "This is a comment" |
| 98 | +``` |
| 99 | +
|
| 100 | +### Shows how to create a Database Grant in Snowflake |
| 101 | +```yaml |
| 102 | +--- |
| 103 | +AWSTemplateFormatVersion: '2010-09-09' |
| 104 | +Description: Shows how to create a Database Grant in Snowflake |
| 105 | +Resources: |
| 106 | + NewDatabaseGrant: |
| 107 | + Type: Snowflake::Database::Grant |
| 108 | + Properties: |
| 109 | + DatabaseName: MyDatabaseName |
| 110 | + Privilege: USAGE |
| 111 | + Role: MyRoleName |
| 112 | +``` |
| 113 | +
|
| 114 | +### Shows how to create a Role Grant in Snowflake |
| 115 | +```yaml |
| 116 | +--- |
| 117 | +AWSTemplateFormatVersion: '2010-09-09' |
| 118 | +Description: Shows how to create a Role Grant in Snowflake |
| 119 | +Resources: |
| 120 | + NewRoleGrant: |
| 121 | + Type: Snowflake::Role::Grant |
| 122 | + Properties: |
| 123 | + RoleName: MyRoleName |
| 124 | + User: MyUserName |
| 125 | +``` |
| 126 | +
|
| 127 | +### Shows how to create a Role in Snowflake |
| 128 | +```yaml |
| 129 | +--- |
| 130 | +AWSTemplateFormatVersion: '2010-09-09' |
| 131 | +Description: Shows how to create a Database in Snowflake |
| 132 | +Resources: |
| 133 | + NewRole: |
| 134 | + Type: Snowflake::Role::Role |
| 135 | + Properties: |
| 136 | + Name: ExampleRole |
| 137 | + Comment: This is an example Role |
| 138 | +``` |
| 139 | +
|
| 140 | +### Shows how to create a User in Snowflake |
| 141 | +```yaml |
| 142 | +--- |
| 143 | +AWSTemplateFormatVersion: '2010-09-09' |
| 144 | +Description: Shows how to create a User in Snowflake |
| 145 | +Resources: |
| 146 | + NewUser: |
| 147 | + Type: Snowflake::User::User |
| 148 | + Properties: |
| 149 | + Name: ExampleUser |
| 150 | + Password: 07l2S5vWjd0N |
| 151 | + FirstName: Example |
| 152 | + LastName: User |
| 153 | +``` |
| 154 | +
|
| 155 | +### Shows how to create a Warehouse Grant in Snowflake |
| 156 | +```yaml |
| 157 | +--- |
| 158 | +AWSTemplateFormatVersion: '2010-09-09' |
| 159 | +Description: Shows how to create a Warehouse Grant in Snowflake |
| 160 | +Resources: |
| 161 | + NewWarehouseGrant: |
| 162 | + Type: Snowflake::Warehouse::Grant |
| 163 | + Properties: |
| 164 | + WarehouseName: MyWarehouseName |
| 165 | + Privilege: USAGE |
| 166 | + Role: MyRoleName |
| 167 | +``` |
| 168 | +
|
| 169 | +[1]: https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-types.html |
| 170 | +[2]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html |
| 171 | +[3]: https://aws.amazon.com/account/ |
| 172 | +[4]: https://aws.amazon.com/cli/ |
| 173 | +[5]: https://aws.amazon.com/console/ |
| 174 | +[6]: https://console.aws.amazon.com/cloudformation/home |
| 175 | +[7]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/registry.html |
| 176 | +
|
| 177 | +[10]: https://docs.snowflake.com/en/user-guide/intro-key-concepts.html#database-storage |
| 178 | +[11]: ./Snowflake-Database-Database/ |
| 179 | +[12]: https://docs.snowflake.com/en/sql-reference/sql/grant-privilege.html |
| 180 | +[13]: ./Snowflake-Database-Grant/ |
| 181 | +[14]: https://docs.snowflake.com/en/sql-reference/sql/grant-privilege.html |
| 182 | +[15]: ./Snowflake-Role-Grant/ |
| 183 | +[16]: https://docs.snowflake.com/en/sql-reference/sql/show-roles.html |
| 184 | +[17]: ./Snowflake-Role-Role/ |
| 185 | +[18]: https://docs.snowflake.com/en/user-guide/intro-key-concepts.html#database-storage |
| 186 | +[19]: ./Snowflake-User-User/ |
| 187 | +[20]: https://docs.snowflake.com/en/sql-reference/sql/grant-privilege.html |
| 188 | +[21]: ./Snowflake-Warehouse-Grant/ |
| 189 | +
|
| 190 | +[22]: https://snowflake.com/ |
0 commit comments