Can I test AWS Glue code locally?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
AWS Glue is a fully managed extract, transform, and load (ETL) service that makes it easier for users to prepare and load their data for analytics. A frequent question developers have is whether they can test AWS Glue code locally before deploying it to the cloud. Testing locally can save time and resources by identifying issues early in the development process. Fortunately, testing AWS Glue code locally is possible, and doing so involves understanding several aspects of the service, along with certain tools and configurations.
Local Testing of AWS Glue Code
Why Test Locally?
Testing AWS Glue scripts and jobs locally can provide several benefits:
- Speed: Local testing can be faster than cloud deployment.
- Cost Efficiency: Minimizes costs associated with running code on AWS resources.
- Debugging: Easier debugging with local tools.
Setting Up a Local Environment
- AWS Glue Libraries: To run Glue ETL code locally, you need the necessary libraries. AWS provides the AWS Glue ETL library, which you can run on your local machine. These libraries are available through Apache Maven on the AWS site.
- Python and Virtual Environments: AWS Glue supports scripting in Python or Scala. Python users can create isolated environments using
virtualenvto manage dependencies. - Docker Setup: For an even closer approximation of the AWS Glue environment, you can use Docker. AWS offers a Glue Local Docker image that mimics the AWS Glue environment. This is beneficial for simulating distributed tasks locally.
Sample Python Setup
Here's a generic setup process for Python:
- Resource Limitation: Your local machine might not mimic the resources available in the AWS environment, especially for memory and parallelism.
- Configuration Files: Ensure that configuration files and specific paths are correctly set.
Parameterssuch as input paths, output paths, and AWS credentials need careful setup locally. - Simulating AWS Services: Some Glue scripts interact with other AWS services like S3. You'll need to mock these services locally, or better yet, use AWS's test environments.
Related reading
- Can I update an existing Amazon S3 object?
- Can I use AWS Certificate Manager certificates for API Gateway with Custom Domain Name
- Can I use boto3 anonymously?
- Can I use local SSDs on GKE for fast, temporary storage within a pod?
- Can I write into the console in a unit test? If yes, why doesn''t the console window open?
- Can Mockito capture arguments of a method called multiple times?
- Can I use PouchDB with Dynamo on the back instead of Couch?
- Can I write to an AWS MSK Kafka cluster from a Lambda function?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.