AWS Glue Partition

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

aws_glue_partition (Terraform)

The Partition in AWS Glue can be configured in Terraform with the resource name aws_glue_partition. The following sections describe 1 example of how to use the resource and its parameters.

Example Usage from GitHub

glue_partition.tf#L4
resource "aws_glue_partition" "glue_partition" {
  count = var.enable_glue_partition ? 1 : 0

  database_name    = var.glue_partition_database_name != "" ? var.glue_partition_database_name : (var.enable_glue_catalog_database ? aws_glue_catalog_database.glue_catalog_database[0].name : null)
  table_name       = var.glue_partition_table_name != "" ? var.glue_partition_table_name : (var.enable_glue_catalog_table ? aws_glue_catalog_table.glue_catalog_table[0].name : null)
  partition_values = var.glue_partition_partition_values

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 Partition Resource.

AWS::Glue::Partition (CloudFormation)

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

Example Usage from GitHub

template.yml#L9
    Type: AWS::Glue::Partition
    Properties:
      CatalogId: String
      DatabaseName: String
      PartitionInput:
        PartitionInput
CF%20Template-data-lake-resource-deploy.yml#L84
    Type: AWS::Glue::Partition
    Properties:
      CatalogId: !Ref AWS::AccountId
      DatabaseName: !Ref testdb
      TableName: !Ref Table1
      PartitionInput:
CFNGlueDatabaseTablePartition.yml#L69
    Type: AWS::Glue::Partition
    Properties:
      CatalogId: !Ref AWS::AccountId
      DatabaseName: !Ref CFNDatabaseName
      TableName: !Ref CFNTableName1
      PartitionInput:
glutable.yml#L68
    Type: AWS::Glue::Partition
    Properties:
      CatalogId: !Ref AWS::AccountId
      DatabaseName: !Ref TestDB
      TableName: !Ref Table1
      PartitionInput:
template2.yml#L103
    Type: AWS::Glue::Partition
    Properties:
      CatalogId: !Ref AWS::AccountId
      DatabaseName: !Ref DatabaseName
      TableName: !Ref TableName
      PartitionInput:
GluePartitionSpecification.json#L3
    "AWS::Glue::Partition.StorageDescriptor": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html",
      "Properties": {
        "StoredAsSubDirectories": {
          "Required": false,
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html#cfn-glue-partition-storagedescriptor-storedassubdirectories",
GluePartitionSpecification.json#L3
    "AWS::Glue::Partition.StorageDescriptor": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html",
      "Properties": {
        "StoredAsSubDirectories": {
          "Required": false,
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html#cfn-glue-partition-storagedescriptor-storedassubdirectories",
GluePartitionSpecification.json#L3
    "AWS::Glue::Partition.StorageDescriptor": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html",
      "Properties": {
        "StoredAsSubDirectories": {
          "Required": false,
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html#cfn-glue-partition-storagedescriptor-storedassubdirectories",
GluePartitionSpecification.json#L3
    "AWS::Glue::Partition.StorageDescriptor": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html",
      "Properties": {
        "StoredAsSubDirectories": {
          "Required": false,
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html#cfn-glue-partition-storagedescriptor-storedassubdirectories",
GluePartitionSpecification.json#L3
    "AWS::Glue::Partition.StorageDescriptor": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html",
      "Properties": {
        "StoredAsSubDirectories": {
          "Required": false,
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html#cfn-glue-partition-storagedescriptor-storedassubdirectories",

Parameters

Explanation in CloudFormation Registry

The AWS::Glue::Partition resource creates an AWS Glue partition, which represents a slice of table data. For more information, see CreatePartition Action and Partition Structure in the AWS Glue Developer Guide.

Frequently asked questions

What is AWS Glue Partition?

AWS Glue Partition 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 Partition?

For Terraform, the SebastianUA/terraform-aws-glue source code example is useful. See the Terraform Example section for further details.

For CloudFormation, the MohamedMesrah/SAM-Resources, godwillngwanah/AWS-Sol-Arch-02 and RittikaJ/awssync source code examples are useful. See the CloudFormation Example section for further details.