AWS Cloudformation: is there a way to capture Glue ARN for use in a step function?
Asked Answered
T

2

6

My task is to create a cloudformation template that produces a glue job and then sets that glue job up as the first step function task.

I have the two pieces working separately, but I don't seem to be able to get the Glue job ARN, if there even is one created:

https://theburningmonk.com/cloudformation-ref-and-getatt-cheatsheet/

If it is created, according to this cheatsheet, it's not available to cloudformation GetAtt ..

Am I missing something? Any way to do this?

Truculent answered 7/5, 2020 at 5:39 Comment(2)
The Glue API doesn't return the ARN for any of its resources. It's definitely a hole in their API, especially when you need the ARN to do other things like get the tags. – Alternate
The format for Glue ARNs is defined here: docs.aws.amazon.com/glue/latest/dg/… – Alternate
H
10

AWS::Glue::Job does not return its ARN.

However, you can construct it yourself, since Glue job ARN has known format and !Ref <glue-job-resource> returns job name.

So for example to return Arn in Outputs, you could do the following:

Outputs:
  JobArn:
    Value: !Sub "arn:${AWS::Partition}:glue:${AWS::Region}:${AWS::AccountId}:job/${<glue-job-resource>}"
Horologium answered 7/5, 2020 at 5:45 Comment(0)
T
2

If you are using boto3 then you need arns of glue.

here is the pattern. Name of job you can find by response = client.list_jobs(MaxResults=123)

use a for loop to generate arns

for jb response['jobs']:
     arn:aws:glue:eu-central-1:1234567891011:job/jb

"arn:aws:glue:<<region>>:<<accountid>>:job/<<NameOfJob>>"

example output πŸš€πŸ˜Ž:

"arn:aws:glue:eu-central-1:1234567891011:job/abc_s3_to_redshift"

Textbook answered 20/6, 2022 at 19:32 Comment(0)

© 2022 - 2024 β€” McMap. All rights reserved.