Friday, October 25

How to setup Lambda Function in VPC to access internet

AWS Lambda functions are great for anyone who is creating a full-blown serverless system or simply want to offload small computational tasks without worrying too much about infrastructure. For reasons of security, accessing to VPC resources, or just for fun, some of us would like to put our Lambda functions in a Virtual Private Cloud (VPC). The first thing you would notice as soon as you place your function into a VPC is that AWS immediately gives you a warning message about losing access to the Internet. Here is the full message:

"When you enable a VPC, your Lambda function loses default internet access. If you require external internet access for your function, make sure that your security group allows outbound connections and that your VPC has a NAT gateway."

But unfortunately, AWS did not provide much detail on how to configure the NAT gateway in order for your functions to access the internet. AWS knowledge center has a nice video by Kien on how the setup can be done; you can find the video here:

However, if you are like me who has no patience of sitting through watching a video of screen capture on how to set up this step-by-step then this guide is for you 😉

The setup is pretty standard and can be most easily illustrated with a diagram. 

This setup requires 3 different subnets in your VPC - Public Subnet, Private Subnet A, and Private Subnet B. Public Subnet has both an Internet Gateway as well as a NAT Gateway assigned to it as illustrated in the diagram. The NAT gateway will also require an Elastic IP, and this Elastic IP will be the source public IP for all traffic coming from your Lambda functions; it is especially handy if you need to use IP whitelisting for external services. 

The two private subnets A and B should be created in different availability zones for high availability. This is a recommended practice though not mandatory; your Lambda function will work even if there is only one private subnet. You should only place your Lambda function in private subnets never the public one. 

Finally, we then need two routing tables in this setup one for privates subnets and another for the public subnet. The private routing table should route all traffic (with mask to the NAT gateway while the public routing table should route all traffic (with mask to the Internet gateway. 

Now you have it; at this point, all your Lambda function in your VPC should have access to the Internet. Have fun!

Wednesday, November 6

Data Visualization with D3.js Cookbook

For the last 7 months I have been working on Data Visualization with D3.js Cookbook with Packt Publishing. It has been a very interesting and educational journey for me personally. Moreover it definitely made me appreciate more about book writing and authors who just have their ways with words produced books we come to enjoy. Last week I have finally arrived at the end of this amazing journey and published this humble cookbook.

Data Visualization with D3.js Cookbook

It is now available at:

All recipes in this cookbook can be found here live online

Thursday, August 22

dc.js v1.5 released

  • enhanced focus and zoom capability
  • overhaul stacking logic to better support different stacking styles
  • introduced legend widget 
  • various bug fixes and minor enhancements (see v1.5 issue log for details)
See updated Nasdaq example for live demo

Saturday, June 22

dc.js v1.4 released

dc.js v1.4 - a mutli-dimensional charting library built with crossfilter and d3 was released today. This release has some of the most long anticipated features in the backlog:

  • multi-selection filtering (initially implemented by @davidda)
  • elastic x-axis for row chart
  • mouse zoomable line/bar/composite chart (contributed by @ChaksChigurupati) 
And with various bug fixes and minor enhancements (see v1.4.0 issue log for details). Make sure to check out our updated example page to see these features in action.

Saturday, June 8

ThoughtWorks 2013 NA Away Day Notes

Yesterday I landed in beautiful Denver CO attending this year's North American ThoughtWorks Away Day held at Keystone Resort for the weekend.

For large part of today I have been inspired and challenged by brilliant sessions given by fellow thought workers and in this blog I would like to share some of my random thoughts on these topics. The following thought fragments are written as notes, not in any particular order:
  • Deliver but don't be afraid of failure 
  • Fail fast and cheaply
  • Ideally fail before delivery and in small increment
  • Focus on idea validation
  • Open to differences in idea
  • Success criteria should be defined with client not by implementer
  • Stake holder should become influencer and even implementer not just holder
  • Classic (state driven) vs. Mockist (interaction driven) unit testing
  • Unit Test, Integration Test, Component Test, End2End Test, Contract Test -> MicroService Test Strategy
  • Internal service resource to facilitate testing
  • Give contract test kit to up-steam service team so they can integrate it into their pipeline
  • Contract for the same service is different for different service consumer
  • Test brittleness goes up as you climb the pyramid 
  • Lower the cost of failure and faster we can fail the higher the anti-fragility
  • Tossing out code is better than maintaining unused feature
  • Design/Validation by elimination
  • Use "specification by example" to drive requirement
  • QA engagement early on
  • Think of QA as XD for negative path
  • XD tends to focus more on happy path
  • Path mapping: map happy/sad path for different persona to bring visibility to product and stake holders
  • Analytics (facts) driven experience design
  • Everything becomes better with example
  • Analytics - better business decision support 

Wednesday, April 17

dc.js v1.3 released

dc.js v1.3 was released with a new type of chart support - Row Chart (thanks to Leo Sun's contribution). 

Check out our updated NASDAQ example page to see it in action. On top of that in this release now dc.js also supports run-time dimension and group switch.

Saturday, March 9

dc.js v1.2 release

Just released dc.js v1.2. In this release the following enhancement and bugfixes were introduced:

  • Overhaul how Coordinate Grid chart handles negative values, and making this kind of rendering possible.

Try it out today.