/ aws

Developing in us-east-1 is toxic ☠️

Since many AWS products default to the original Virginia region, building the first of anything there will frequently lead to code that is blissfully unaware of regions. As soon as deployment to a different region is attempted, things break in obtuse ways.

AWS EMR 🤞 I know this job exists

A tiny story of misleading errors with a common cause.

Using Amazon EMR service and baffled by this error when you know the job exists?

…AmazonElasticMapReduceException: Specified job flow ID does not exist.

Possible answer 📍 Set the region

Here's how we set the EMR region in Scala using the AWS SDK for Java:

val regionId  = sys.env("AWS_REGION")
val accessKey = sys.env("AWS_ACCESS_KEY_ID")
val secretKey = sys.env("AWS_SECRET_ACCESS_KEY")

val credentials = new BasicAWSCredentials(
  accessKey,
  secretKey)
val emr = new AmazonElasticMapReduceClient(
  credentials)
emr.setEndpoint(
  s"elasticmapreduce.${regionId}.amazonaws.com")
  
// Now `emr` will operate with the region.

Inexplicable AWS error?

Is it plugged in? 🔌 No really, check if the AWS region is set correctly. That means different things for different services. For EMR, it means setting the endpoint. Repeatedly we've seen vague or misleading errors thanks to an incorrect AWS Region.

Also, Signature V4 is required in regions built since 2014. Obtuse authentication errors can emerge from code built for us-east-1 and then deployed in a different, newer region.

So, join me in us-west-2

…where nothing we do is default 🎸😆