How to call AWS Glue crawler from AWS Glue job using Scala API?

147 Views Asked by At

I want to call GlueCrawler from the Glue job. I see there is an API https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-crawler-crawling.html#aws-glue-api-crawler-crawling-StartCrawler
But I totally lost how I can call it? I can't find examples in internet as well. I found some Python samples using boto3 and it is working fine, but I need scala call.
If I understand correctly, I need some how instantiate GlueClient and call startCrawler operation on it, but how to do it? All examples that I found operates only on GlueContext and it is not clear how to retrieve GlueClient from it(if it is possible at all?).

1

There are 1 best solutions below

1
Gastón Schabas On

I haven´t workded with glue, but looks like there is a JDK SDK for glue with some examples of how to start a crawler. One of them, shows how to start a crawler, but as you said the GlueClient is provided. Based on the thread How to Get AWS Glue Client in Java, you should be able to create an instance of the client doing something like

AWSGlueClient.builder().withRegion("us-east-1").build()

The API Doc of GlueClient shows that the it should be possible to do that.

Hope this helps