AWS Glue Catalog Table

This page shows how to write Terraform and CloudFormation for AWS Glue Catalog Table and write them securely.

aws_glue_catalog_table (Terraform)

The Catalog Table in AWS Glue can be configured in Terraform with the resource name aws_glue_catalog_table. The following sections describe 4 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L7
resource "aws_glue_catalog_table" "fbad_table" {
  name = var.fbad_table_name
  database_name = aws_glue_catalog_database.database.name

  table_type = "EXTERNAL_TABLE"

glue_catalog.tf#L5
resource "aws_glue_catalog_table" "glue_aircrafts_table" {
  name          = "aircrafts"
  database_name = aws_glue_catalog_database.glue_flights_analyser_database.name

  storage_descriptor {
    columns {
main.tf#L7
resource "aws_glue_catalog_table" "fbad_table" {
  name = var.fbad_table_name
  database_name = aws_glue_catalog_database.database.name

  table_type = "EXTERNAL_TABLE"

main.tf#L2
resource "aws_glue_catalog_table" "csv_table" {
  count = (var.source_type == "csv") ? 1 : 0
  name          = var.table_name
  database_name = var.database_name
  table_type    = "EXTERNAL_TABLE"

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides a Glue Catalog Table Resource. You can refer to the Glue Developer Guide for a full explanation of the Glue Data Catalog functionality.

AWS::Glue::Table (CloudFormation)

The Table in Glue can be configured in CloudFormation with the resource name AWS::Glue::Table. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

serverless.yml#L30
    #   Type: AWS::Glue::Table
    #   Properties:
    #     CatalogId: !Ref AWS::AccountId
    #     DatabaseName: !Ref CompanyDatabase
    #     TableInput:
    #       Name: ${self:custom.employees_table}
refdata.yml#L25
    Type: 'AWS::Glue::Table'
    Properties:
      DatabaseName:
        Ref: SecGlueDatabase
      CatalogId:
        Ref: 'AWS::AccountId'
template_CreateTable.yml#L20
    Type: AWS::Glue::Table
    DeletionPolicy: Retain
    Properties:
      CatalogId: !Ref AWS::AccountId
      DatabaseName: !Sub ${Database}
      TableInput:
CreateTable_rakutenpay.yml#L20
    Type: AWS::Glue::Table
    DeletionPolicy: Retain
    Properties:
      CatalogId: !Ref AWS::AccountId
      DatabaseName: !Sub ${Database}
      TableInput:
CreateTable_merpay.yml#L20
    Type: AWS::Glue::Table
    DeletionPolicy: Retain
    Properties:
      CatalogId: !Ref AWS::AccountId
      DatabaseName: !Sub ${Database}
      TableInput:
integ.table.expected.json#L20
      "Type": "AWS::Glue::Table",
      "Properties": {
        "CatalogId": {
          "Ref": "AWS::AccountId"
        },
        "DatabaseName": {
integ.table.expected.json#L20
      "Type": "AWS::Glue::Table",
      "Properties": {
        "CatalogId": {
          "Ref": "AWS::AccountId"
        },
        "DatabaseName": {
CovidDataLakeStack.json#L18
      "Type": "AWS::Glue::Table",
      "Properties": {
        "CatalogId": {
          "Ref": "AWS::AccountId"
        },
        "DatabaseName": {
CovidLakeStack.template.json#L18
      "Type": "AWS::Glue::Table",
      "Properties": {
        "CatalogId": {
          "Ref": "AWS::AccountId"
        },
        "DatabaseName": {
CovidLakeStack.template.json#L18
      "Type": "AWS::Glue::Table",
      "Properties": {
        "CatalogId": {
          "Ref": "AWS::AccountId"
        },
        "DatabaseName": {

Parameters

Explanation in CloudFormation Registry

The AWS::Glue::Table resource specifies tabular data in the AWS Glue data catalog. For more information, see Defining Tables in the AWS Glue Data Catalog and Table Structure in the AWS Glue Developer Guide.

Frequently asked questions

What is AWS Glue Catalog Table?

AWS Glue Catalog Table is a resource for Glue of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Glue Catalog Table?

For Terraform, the devopsbynaresh/datalake-alsac, piotsik/flights_analyser and devopsbynaresh/infrastructure-alsac source code examples are useful. See the Terraform Example section for further details.

For CloudFormation, the edgar-quiroz/aws_data_platform, tradle/mycloud and KazuyaOnda/create-s3-bucket source code examples are useful. See the CloudFormation Example section for further details.