Skip to content

Commit 9c22428

Browse files
committed
Adds individual README files
1 parent 9024750 commit 9c22428

File tree

7 files changed

+749
-206
lines changed

7 files changed

+749
-206
lines changed

README.md

+190-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,190 @@
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/

Snowflake-Database-Database/README.md

+95-34
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,100 @@
11
# Snowflake::Database::Database
22

3-
Congratulations on starting development! Next steps:
4-
5-
1. Write the JSON schema describing your resource, [snowflake-database-database.json](./snowflake-database-database.json)
6-
2. Implement your resource handlers in [handlers.ts](./snowflake-database-database/handlers.ts)
7-
8-
> Don't modify [models.ts](./snowflake-database-database/models.ts) by hand, any modifications will be overwritten when the `generate` or `package` commands are run.
9-
10-
Implement CloudFormation resource here. Each function must always return a ProgressEvent.
11-
12-
```typescript
13-
const progress = ProgressEvent.builder<ProgressEvent<ResourceModel>>()
14-
15-
// Required
16-
// Must be one of OperationStatus.InProgress, OperationStatus.Failed, OperationStatus.Success
17-
.status(OperationStatus.InProgress)
18-
// Required on SUCCESS (except for LIST where resourceModels is required)
19-
// The current resource model after the operation; instance of ResourceModel class
20-
.resourceModel(model)
21-
.resourceModels(null)
22-
// Required on FAILED
23-
// Customer-facing message, displayed in e.g. CloudFormation stack events
24-
.message('')
25-
// Required on FAILED a HandlerErrorCode
26-
.errorCode(HandlerErrorCode.InternalFailure)
27-
// Optional
28-
// Use to store any state between re-invocation via IN_PROGRESS
29-
.callbackContext({})
30-
// Required on IN_PROGRESS
31-
// The number of seconds to delay before re-invocation
32-
.callbackDelaySeconds(0)
33-
34-
.build()
3+
This resource type manages a [Snowflake Database][1]
4+
5+
[Documentation][2]
6+
7+
## Prerequisites
8+
* [AWS Account][14]
9+
* [AWS CLI][15]
10+
* [Snowflake account][16]
11+
12+
To get started:
13+
14+
1. Sign in to the [AWS Management Console][11] with your account and navigate to CloudFormation.
15+
16+
2. Select "Public extensions" from the left hand pane and filter Publisher by "Third Party".
17+
18+
3. Use the search bar to filter by the "Snowflake" prefix.
19+
20+
Note: All official Snowflake resources begin with `Snowflake::` and specify that they are `Published by Snowflake`.
21+
22+
4. Select the desired resource name to view more information about its schema, and click **Activate**.
23+
24+
5. On the **Extension details** page, specify:
25+
- Extension name
26+
- Execution role ARN
27+
- Automatic updates for minor version releases
28+
- Configuration
29+
30+
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:
31+
32+
33+
For example:
34+
35+
```Bash
36+
$ aws cloudformation set-type-configuration \
37+
--region us-west-2 --type RESOURCE \
38+
--type-name Snowflake::Database::Database \
39+
--configuration-alias default \
40+
--configuration "{ \"SnowflakeAccess\":{\"Account\":\"YOURACCOUNT\", \"Username\":\"YOURUSERNAME\", \"Password\":\"YOURPASSWORD\"}}"
41+
```
42+
43+
7. After you have your resource configured, [create your AWS stack][12] that includes any of the activated Snowflake resources.
44+
45+
For more information about available commands and workflows, see the official [AWS documentation][13].
46+
47+
## Supported regions
48+
49+
The Snowflake CloudFormation resources are available on the CloudFormation Public Registry in the following regions:
50+
51+
| Code | Name |
52+
|-----------------|---------------------------|
53+
| us-east-1 | US East (N. Virginia) |
54+
| us-east-2 | US East (Ohio) |
55+
| us-west-1 | US West (N. California) |
56+
| us-west-2 | US West (Oregon) |
57+
| ap-south-1 | Asia Pacific (Mumbai) |
58+
| ap-northeast-1 | Asia Pacific (Tokyo) |
59+
| ap-northeast-2 | Asia Pacific (Seoul) |
60+
| ap-southeast-1 | Asia Pacific (Singapore) |
61+
| ap-southeast-2 | Asia Pacific (Sydney) |
62+
| ca-central-1 | Canada (Central) |
63+
| eu-central-1 | Europe (Frankfurt) |
64+
| eu-west-1 | Europe (Ireland) |
65+
| eu-west-2 | Europe (London) |
66+
| eu-west-3 | Europe (Paris) |
67+
| eu-north-1 | Europe (Stockholm) |
68+
| sa-east-1 | South America (São Paulo) |
69+
70+
**Note**: To privately register a resource in any other region, use the provided packages.
71+
72+
## Examples
73+
74+
75+
### Shows how to create a Database in Snowflake
76+
```yaml
77+
---
78+
AWSTemplateFormatVersion: '2010-09-09'
79+
Description: Shows how to create a Database in Snowflake
80+
Resources:
81+
NewDatabase:
82+
Type: Snowflake::Database::Database
83+
Properties:
84+
Name: ExampleDatabase
85+
DataRetentionTimeInDays: 1
86+
MaxDataExtensionTimeInDays: 1
87+
DefaultDdlCollation: "en-ci"
88+
Comment: "This is a comment"
3589
```
3690
37-
While importing the [@amazon-web-services-cloudformation/cloudformation-cli-typescript-lib](https://github.com/eduardomourar/cloudformation-cli-typescript-plugin) library, failures can be passed back to CloudFormation by either raising an exception from `exceptions`, or setting the ProgressEvent's `status` to `OperationStatus.Failed` and `errorCode` to one of `HandlerErrorCode`. There is a static helper function, `ProgressEvent.failed`, for this common case.
91+
[1]: https://docs.snowflake.com/en/user-guide/intro-key-concepts.html#database-storage
92+
[2]: ./docs/README.md
93+
94+
[11]: https://aws.amazon.com/console/
95+
[12]: https://console.aws.amazon.com/cloudformation/home
96+
[13]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/registry.html
97+
[14]: https://aws.amazon.com/account/
98+
[15]: https://aws.amazon.com/cli/
99+
[16]: https://snowflake.com/
38100
39-
Keep in mind, during runtime all logs will be delivered to CloudWatch if you use the `log()` method from `LoggerProxy` class.

0 commit comments

Comments
 (0)