cloudfomation怎么创建glue资源
时间: 2024-03-17 21:40:33 浏览: 27
您可以使用AWS CloudFormation创建AWS Glue资源,包括数据库、表、作业、触发器等等。以下是一个简单的CloudFormation模板示例,用于创建一个AWS Glue的数据库和表:
```yaml
Resources:
MyGlueDatabase:
Type: AWS::Glue::Database
Properties:
DatabaseInput:
Name: my_database_name
MyGlueTable:
Type: AWS::Glue::Table
Properties:
CatalogId: !Ref AWS::AccountId
DatabaseName: !Ref MyGlueDatabase
TableInput:
Name: my_table_name
Description: My table description
Parameters:
classification: json
StorageDescriptor:
Columns:
- Name: column_1
Type: string
- Name: column_2
Type: int
Location: s3://my-bucket/my-folder/
InputFormat: org.apache.hadoop.mapred.TextInputFormat
OutputFormat: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
SerdeInfo:
SerializationLibrary: org.apache.hadoop.hive.serde2.OpenCSVSerde
Parameters:
separatorChar: ","
TableType: EXTERNAL_TABLE
```
该模板包括2个资源:一个AWS Glue的数据库和一个AWS Glue的表。其中,数据库的名称为`my_database_name`,表的名称为`my_table_name`,表的列包括`column_1`和`column_2`,表的数据存储在S3桶中。
您可以根据自己的需求修改模板中的各种参数,例如数据库和表的名称、列的定义、数据存储路径等等。将该模板保存为一个YAML文件,然后使用AWS CloudFormation控制台或CLI来部署该模板,即可创建AWS Glue的数据库和表。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)