Skip to content

Instantly share code, notes, and snippets.

View ogavrisevs's full-sized avatar

Oskars Gavriševs ogavrisevs

View GitHub Profile

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.
@bcremer
bcremer / gist:12167985b442d0d195de
Created August 5, 2014 12:01
NGINX as caching REST-API Proxy
upstream backend {
server localhost:8080;
#server backup1.example.com:8080 backup;
#server backup2.example.com:8080 backup;
}
# Set cache dir
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:10m;
# Set cache key to include identifying components
@filler
filler / README.md
Created July 11, 2012 15:35
RHEL 6.3 veewee templates for vagrant use

RHEL 6.3 veewee templates for vagrant use

These templates can be used to feed to veewee to spin up an el6 basebox for use with vagrant.

There are some coded values in definition.rb and ks.cfg which point at Yale-ishness. Amend to point at local RHEL iso/yum repo.

Built successfully with veewee 0.2.3, vagrant 1.0.3, Virtualbox 4.1.18.

Config Management

@ogavrisevs
ogavrisevs / sample.java
Created June 7, 2012 07:06
Create pdf using pd4ml from html (html table is unsuported )
ByteArrayInputStream inputStream = new ByteArrayInputStream(htmlData);
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
PD4ML pd4ml = new PD4ML();
pd4ml.enableDebugInfo();
try {
pd4ml.setPageSize( PD4Constants.A4 );
pd4ml.setPageInsetsMM( new Insets(topValue, leftValue, bottomValue, rightValue) );
@cheeming
cheeming / gist:2850764
Created June 1, 2012 09:37
Groovy script to get git HEAD to be used in Jenkins
import hudson.FilePath;
import hudson.util.StreamTaskListener;
import hudson.plugins.git.GitAPI;
import hudson.EnvVars;
j = Jenkins.instance.getJob("codility");
workspace_path = j.getRootDir().toString() + "/workspace";
workspace = new FilePath(new File(workspace_path));
listener = new StreamTaskListener();
envvars = new EnvVars();
@rajraj
rajraj / es.sh
Created January 3, 2012 20:07 — forked from aaronshaf/es.sh
Install ElasticSearch on CentOS 6
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk.i686 -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share