What is the difference between AWS Glue ETL Job and AWS EMR?

Viewed 3461

If I had to perform ETL on a huge dataset(say 1Tb) stored in S3 as csv files, Both AWS Glue ETL job and AWS EMR steps can be used. Then how is AWS Glue different from AWS EMR. And which is the better solution in this case.

5 Answers

Glue allows you to submit ETL scripts directly in PySpark/Python/Scala, without the need for managing an EMR cluster. All setup/tear-down of infrastructure is managed.

There are also a few other managed components like Crawlers, Glue Data Catalog, etc which make it easier to work on your data.

You could use either for your use-case, Glue would be faster however you may not have the flexibility you get with EMR.

Most of the differences are already listed so I'll focus more on the use case specific.

When to choose aws glue

  1. Data size is huge but structured i.e. it is in the table structure and is of known format (CSV, parquet, orc, json).
  2. Lineage is required, if you need the data lineage graph while developing your etl job prefer developing the etl using glue native libraries.
  3. The developers don't need to tweak the performance parameters like setting number of executors, per executor memory and so on.
  4. You don't want the overhead of managing large cluster and pay only for what you use.

When to use EMR

  1. Data is huge but semi-structured or unstructured where you can't take any benefit from Glue catalog.
  2. You believe only in the outputs and lineage is not required.
  3. You need to define more memory per executor depending upon the type of your job and requirement.
  4. You can manage the cluster easily or if you have so many jobs which can run concurrently on the cluster saving you money.
  5. In case of structured data, you should use EMR when you want more Hadoop capabilities like hive, presto for further analytics.

So it depends on what your use case is. Both are great service.

Glue uses EMR under the hood. This is evident when you ssh into the driver of your Glue dev-endpoint.

Now since Glue is a managed spark environment or say managed EMR environment, it comes with reduced flexibility. The type of workers that you can chose is limited. The number of language libraries that you can use in your spark code is limited. Glue did not support packages like pandas, numpy until recently. Apps like presto cant be integrated with Glue although Athena is a good alternative to a separate presto installation.

The main issue however is that Glue jobs have a cold start time from anywhere between 1 minute to 15 minutes.

EMR is a good choice for exploratory data analysis but for a production environment with CI/CD, Glue seems to be the better choice.

EDIT - Glue jobs no longer have a cold start wait time

From the AWS Glue FAQ:

AWS Glue works on top of the Apache Spark environment to provide a scale-out execution environment for your data transformation jobs. AWS Glue infers, evolves, and monitors your ETL jobs to greatly simplify the process of creating and maintaining jobs.

Amazon EMR provides you with direct access to your Hadoop environment, affording you lower-level access and greater flexibility in using tools beyond Spark.

Source: https://aws.amazon.com/glue/faqs/

AWS Glue is a ETL service from AWS. AWS Glue will generate ETL code in Scala or Python to extract data from the source, transform the data to match the target schema, and load it into the target

AWS EMR is a service where you can process large amount of data , its a supporting big data platform .It Supports Hadoop,Spark,Flink,Presto, Hive etc.You can spin up EC2 with the above listed softwares and make a similar ecosystem.

In your case , you want to process 1 TB of data .Now if you want do computations on the same data , you can use EMR and if you want to run the analytics on the transformed data , use Glue .

Related