Infoblox with AWS Lambda, CloudFormation, and CloudTrail Part 3 - Lambda Function Setup
In the previous blog post in this series I covered the installation and configuration of an Infoblox Cloud Platform Appliance in an AWS VPC to the point that it is ready to take API calls that will be used to automate the AWS environment. Now we get to the hard part. In this post I’ll show you how to configure some AWS Lambda functions to interface with the CP appliance and in the next couple of blog posts I’ll demonstrate how to trigger these Lambda functions with AWS CloudFormation and CloudTrail. Warning, this post is going to get code-heavy.
AWS Lambda supports functions written in Python, Java, and Node.js. I know Python and there’s an Infoblox Python library that saves me re-writing all of the API calls by hand, so that’s what I’ll use for the examples here. Not every API call is written into the Python module so there will still be some REST calls in the scripts. That semi-official Python library can be found at https://github.com/infobloxopen/infoblox-client.
First I’ll go over a few critical points on how AWS Lambda works. I highly recommend you read the Developer Guide (http://docs.aws.amazon.com/lambda/latest/dg/welcome.html) to learn it in more detail. Essentially Lambda takes code that you write and invokes it in an ephemeral EC2 instance in response to other AWS events. There’s no need to maintain any operating system or other infrastructure and you only pay for the time that the code is being run which is typically a few seconds or less. The key things to bear in mind is that Lambda provides you with specific inputs to the function in your code and expects a few outputs to determine whether the code invocation was successful. You also need to bundle all of the libraries you need for your code in with the code that you will upload as a gzip file. With Python I do all Lambda code development using the Python virtualenv tool inside an isolated environment to ensure I include all of those necessary libraries and don’t accidentally use libraries included in my default environment.
Categories
- All Categories
- 5.1K Forums
- 4.6K Critical Network Services
- 463 Security
- Visibility and Insights
- Ideas Portal
- Webinars & Events
- 266 Resources
- 266 News & Announcements
- Knowledge Base Articles
- Infoblox Documentation Portal
- Infoblox Blog
- Support Portal
- 4 Members Hub
- 4 Getting Started with Community
- Community Support