2
MainGlueJob:
    Type: AWS::Glue::Job
    Properties:
      Name: !Ref GlueJobName
      Role: !Ref GlueResourcesServiceRoleName
      Description: Job created with CloudFormation.
      GlueVersion: 2.0
      Command:
        Name: glueetl
        PythonVersion: 3
        ScriptLocation: !Ref JobScriptLocation
      AllocatedCapacity: 3
      ExecutionProperty:
        MaxConcurrentRuns: 1
      DefaultArguments:
        --job-bookmark-option: job-bookmark-enable
        --enable-continuous-cloudwatch-log: true
        --enable-metrics: true
        --enable-s3-parquet-optimized-committer: true
        --TempDir: 's3://aws-glue-temporary-123-ap-south-1/dir'
      Tags: {
        "tag:Key1": "Value1",
        "tag:Key2": "Value2"
      }

  MainCrawler:
    Type: AWS::Glue::Crawler
    Properties:
      Name: Main
      Role: !Ref GlueResourcesServiceRoleName
      Description: AWS Glue crawler
      DatabaseName: !Ref DatabaseName
      Targets:
        S3Targets:
          - Path: !Ref S3Path
      SchemaChangePolicy:
        UpdateBehavior: "UPDATE_IN_DATABASE"
        DeleteBehavior: "LOG"
      Configuration: '{"Version":1.0,"CrawlerOutput":{"Partitions":{"AddOrUpdateBehavior":"InheritFromTable"},"Tables":{"AddOrUpdateBehavior":"MergeNewColumns"}}}'
      Tags: {
        "tag:Key1": "Value1",
        "tag:Key2": "Value2"
      }

尝试在 SAM 模板中为粘合作业定义标签,但未在粘合作业或爬虫中更新

Tags: {
    "tagKeyName1": "tagValue1",
    "tagKeyName2": "tagValue2",
    "tagKeyName3": "tagValue3"
  }

我只能使用标签更新胶水资源,因为胶水作业已经在使用中。由于 Glue 作业书签无法由用户控制,因此删除和重新创建堆栈将花费我们很多。

我正在使用 SAM 模板并尝试将标签添加到 Glue Job 和 Crawler。

无论如何用标签更新资源?

在 SAM Template for Glue 资源中声明标签的正确格式是什么?

有人想帮忙吗?

4

1 回答 1

0

你可以试试:

Tags: {
    tagKeyName1: !Ref tagValue1
    tagKeyName2: !Ref tagValue2
    tagKeyName3: !Ref tagValue3
  }

这必须是 JSON 格式:不要使用引号或大括号。

于 2021-10-21T20:41:53.347 回答