Jerome Rajan

0 %
Jerome Rajan
Data & AI Architect at Google
  • Residence:
    India
  • City:
    Mumbai
GCP Agent Platform
GenAI
SQL
Dataproc, EMR
Hadoop
BigQuery
PySpark, Python
Data Pipeline Design
Tableau, Redshift, Snowflake
IBM DataStage
  • AWS Lambda, S3, EMR, SQS, DynamoDB, Step Functions, Cloud Functions
  • Unix Shell Scripting, Python
  • Oracle, DB2, Redis
  • Alteryx, VBA, Blueprism, UiPath
English
Tamil
Hindi
Malayalam
Marathi
Spanish

AWS Glue: Develop & Test PySpark ETL Jobs Locally Using Development Endpoints

October 3, 2020

AWS Glue jobs—especially Streaming ETL jobs—can incur cold-start spin-up times of several minutes per run. Setting up an AWS Glue Development Endpoint lets you interactively author, debug, and unit-test PySpark and DynamicFrame code inside a local Jupyter Notebook, Zeppelin Notebook, or REPL before deploying to production.

Cost Warning: AWS Glue Development Endpoints bill continuously per DPU-hour while provisioned—even when idle! Always delete your endpoint at the end of your workday and recreate it the next morning reusing the same SSH key pair.

Step 1: Add a New Development Endpoint

In the AWS Glue Console, select Dev endpoints in the left navigation pane and click Add endpoint.

AWS Glue console showing Dev endpoints menu and Add endpoint button

Step 2: Create an IAM Role for AWS Glue

Create an IAM service role for AWS Glue with read/write permissions to your source and target data stores (S3, RDS, Kinesis, Data Catalog). You can reuse this same role for your final Glue job. Follow the AWS Glue IAM Role documentation.

Step 3: Configure Endpoint Name, Libraries & DPUs

  • Give your development endpoint a clear name.
  • If your job needs external pure-Python wheels/zip packages (for example, pg8000 for PostgreSQL), upload them to S3 and provide a comma-separated S3 URI list under Python library path.
  • Lower Data Processing Units (DPUs) to the minimum (2) to minimize hourly cost during development.
  • Select the IAM role created in Step 2 and click Next.
Configuring AWS Glue development endpoint name, DPUs, and S3 Python library path

Step 4: Select Networking (VPC) Options

Choose the VPC, subnet, and security group required to reach your private RDS/Redshift data stores—or skip networking if accessing only public/S3 endpoints via IAM.

Selecting VPC networking options for an AWS Glue development endpoint

Step 5: Generate an SSH Public/Private Key Pair

  1. On Windows, open PuTTYgen and click Generate (on macOS/Linux, run ssh-keygen -t rsa -b 2048 -f pvt-glue-dev-endpoint-key.pem).
  2. Copy the generated OpenSSH Public Key and save your Private Key (.pem) securely for local port forwarding.
Generating an SSH key pair in PuTTYgen for AWS Glue endpoint tunneling

Step 6: Upload Your Public SSH Key

Paste the public SSH key from Step 5 into the endpoint wizard (connecting from a local Jupyter notebook avoids paying for an extra managed SageMaker/EC2 notebook server) and click Next.

Pasting the SSH public key into the AWS Glue development endpoint wizard

Step 7: Review & Provision

Review your settings and click Finish. Provisioning typically takes 8–10 minutes until the status transitions to READY.

Step 8: Install Jupyter Lab / Notebook Locally

Ensure Jupyter Notebook or JupyterLab with Sparkmagic is installed locally (Apache Zeppelin in Docker works as well; here we focus on Jupyter).

Step 9: Open an SSH Tunnel to Livy (Port 8998)

Once the endpoint is READY, open a terminal and forward local port 8998 to the Apache Livy server running on the Glue endpoint using the private key saved in Step 5:

ssh -i pvt-glue-dev-endpoint-key.pem -NTL :8998:169.254.76.1:8998 glue@<endpoint-public-address>

Step 10: Launch a PySpark Notebook

Launch Jupyter locally and create a new Sparkmagic (PySpark) notebook. Initializing the SparkContext automatically tunnels over port 8998 into the remote AWS Glue Spark kernel!

Interactive PySpark Jupyter notebook connected to an AWS Glue development endpoint

Final Reminder: Delete your Development Endpoint as soon as you wrap up for the day!

Posted in TechnologyTags:
2 Comments
Write a comment
Be Original
Would the boy you were be proud of the man you are?