If you are developing AWS Lambda Functions, you will likely use AWS SAM Local
for running your functions in a local development environment.
AWS SAM Local is a great tool. However, many users, including myself, run into very
slow response times when first using AWS SAM Local, as documented in issue 134.
Simlpe functions may be taking more than 6 or even 10 seconds to evaluate.
This is likely for one of two reasons:
You are using a language with compiled-and-compressed code packages like Java’s JAR files.
You have not configured your AWS credentials.
For (A), AWS SAM Local unpacks your compressed code package on every request.
That process takes a few seconds, period. There are a few workarounds,
which include manually unzipping your .jar and pointing at the unzipped files
in your template.yaml’s CodeUri parameter.
However, if you are not using the C# or Java environments and are still experiencing slow requests,
you are in (B), and you can solve this problem by configuring your AWS Credentials.
indicates that you can provide credentials in one of two ways:
Specify AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables
Configuring a profile in ~/.aws/credentials for Linux or MacOs
Nota Bene: When AWS SAM Local’s README refers to ~/.aws/credentials, there is an implication
that you are using the AWS CLI v2, not the older v1, which stores information in ~/.aws/profile.
There are two gotchas with this documentation:
While both solutions will speed up execution, specifying the environment variables is noticeably faster.
I recommend you skip the AWS CLI configuration and just specify the environment variables.
If you put your credentials in ~/.aws/credentials in a profile, you need to specify --profile <profile_name
when you invoke sam for AWS SAM Local.
Note that for basic AWS SAM local operation, you do not need to specify valid AWS credentials - any old
value, even the empty string, will do!
Recently, I tried to get a development environment set up for developing
a single page web application ClojureScript - but with a backend written
to run on AWS Lambda functions, also in ClojureScript.
ClojureScript seems to use the Google Closure Compiler for compiling
import/export/require system that is different from Node’s module system.
Because AWS Lambda expects your JS to export the handler functions for the
Lambda function using the Node module system, I ended up with a real problem:
How do you require Google Closure-compiled ClojureScript into a node module?
The answer ended up being quite simple. Given that Closure is creating a compiled
file with name functions.js, which in turn is exporting a namespace functions.core,
you can create a new main.js file in the same directory as the compiled functions.js
file with the following content:
This took me longer than I care to admit to figure out, though that’s probably
thanks go to Matthew Stump’s post Writing NodeJS Modules in ClojureScript,
which had the trick as part of it.
Recently, I have been messing around with writing and deploying AWS Lambda
Functions and Microsoft Azure Functions - two “serverless” technologies that
have a lot of promise for certain applications.
For development environments, both rely on using docker images provided by
the respective vendors to run your functions locally.
I attempted to set up Docker on Ubuntu 16.04 by running sudo apt install docker,
which appeared to succeed.
However, when attempting to run docker run hello-world - a command which
should pull a ‘hello world’ image from one of the public docker repositories,
then run it - I received an error to the effect of:
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
The solution to this problem is to either (a) run your docker commands as root,
or (b) add your login user to the docker group.
Option (a) is not preferred, as introducing a sudo dependency will quickly lead
you to ‘sudo hell’ where everything of use requires sudo.
For option (b), you can run sudo usermod -a -G docker $USER, which will add your
user to the docker group.
For the change to take effect, you will need to fully log out of your account and log
Over the past week or so, I have been spending a lot more time reading blogs.
Upon reflection, I am trying to fill a specific hole in my life: I’m not having enough interesting discussions with smart people who have interesting things to say about things that I don’t know about.
That sentence seems a bit long, and maybe convoluted, but I think it is about right. The absence of it is grinding on me.
Prior to 2006, I think this mostly came from speaking to my parents. Being under 12, this was acceptable.
From 2006 to 2009, this mostly came from spending an inordinate amount of time on a old-school web forum that, while centered around a particular game, had a politically diverse, tight knit community who liked to talk about all sorts of things.
From 2009 to 2011, I had truly fantastic teachers and classmates as conversation partners at Robinson High School in Tampa, Florida. In particular, three of my History teachers spent hundreds of hours in ‘study hall’ discussing all manner of things, ultimately teaching me much more than the State of Florida would’ve liked.
From 2011 to 2014, interesting discussions came from a combination of college classes (interesting, but outside of the mathematical classes, lacking), the University Economics Society at the University of Florida (light on economics, heavy on interesting discussion), and thousands of hours of discussion with Steve Spalding (@sbspalding) and Miguel Barbossa (@MiguelABarbossa, check out citizenaudit.org).
I graduated, I threw myself into my company, and then another. For a period in 2016, I got my fill from a wonderful private Facebook group. But like most communities, its moment ended; while it tided me over, after the 2016 election, the high quality discussion ended1.
Then, for three months in 2017, I had a taste of this again, hanging out with the wonderful Richard Stein in Hong Kong.
Given that for the majority of my life I’ve gotten most of my interesting discussion online, it shouldn’t be hard to reconstruct this.
But since 2014, the world has moved. Going through my old follow lists, many people are no longer active. Those who are active are posting less interesting (alternatively: less controversial) ideas in public spaces2.
I am resolved to rebuild. I’ve started by rejecting algorithmic aggregation3: I want to find content that makes me a better thinker and person, not content that monetizes well. The ‘indie web’ (we used to call it ‘the web’).
Here are the blogs that I find interesting and you should check out, along with a couple of keywords:
Dan Luu’s Blog: Low level programming, computer engineering, excellent essays about the market for technical talent.
DaedTech: Mostly commentary on navigating freelance technology roles; excellent writing.
Ben Kuhn: I’ve not read the archives, but general technology, effective altruism.
Decibels and Decimals, Brady Fowler’s music / data sci blog; not super active but every post is a delight.