Skip to content

Instantly share code, notes, and snippets.

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
@bodiam
bodiam / asciidoc.css
Last active August 29, 2015 14:19 — forked from imjasonh/markdown.css
Render HTML as unrendered Asciidoc - See http://jsbin.com/mifepiqosa/1/edit?html,css,output
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@Grab(group = "org.twitter4j", module = "twitter4j-core", version = "4.0.2")
import twitter4j.*
Twitter twitter = new TwitterFactory().instance
def user = twitter.verifyCredentials()
println "Nb followers de ${user.name} (alias ${user.screenName}) : ${user.followersCount}"
long cursor = -1
def followers = twitter.getFollowersList(user.screenName, cursor, 200)
followers.each {println "${it.screenName} - ${it.name}"}
package java8tests ;
import java.util.function.BiFunction ;
import java.util.function.Function ;
public class Currying {
public void currying() {
// Create a function that adds 2 integers
BiFunction<Integer,Integer,Integer> adder = ( a, b ) -> a + b ;
# Fluent Interface Definition
class sql:
class select:
def __init__(self, dbcolumn, context=None):
self.dbcolumn = dbcolumn
self.context = context
def select(self, dbcolumn):
return self.__class__(dbcolumn,self)
# Demo
// querying and cursors
cursor = db.people.find(); null ;
cursor.hasNext() // returns true (if there is another set of results) and false (if not)
cursor.next() // returns the next result and move the cursor foward
// Limiting the set of results returned by the queries
cursor.limit(5); null; // limit the results returned by the cursor (default is 20)
// note: the 'null' keyword is used to prevent the mongoshell from printing that query out
@bodiam
bodiam / gist:5998377
Last active December 19, 2015 18:28 — forked from erdi/gist:5998112
Gradle script to prints the file location of the produced artifact. Can be put in ~/.gradle/init.gradle so it can be used across projects.
allprojects {
tasks.withType(AbstractArchiveTask) { task ->
outputs.upToDateWhen { false }
task.doLast {
println "\nOutput location: ${archiveName}\n"
}
}
}