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.
@ma-nicholas-wan
ma-nicholas-wan / buildspec.yml
Created October 18, 2021 03:23 — forked from miguelmota/buildspec.yml
AWS CodePipeline CodeBuild middleman build deploy to S3 and invalidate cloudfront cache
version: 0.1
phases:
install:
commands:
- apt-get update
- apt-get install nodejs -y
- gem install bundler
- gem install middleman
pre_build:
commands:
@ma-nicholas-wan
ma-nicholas-wan / last_or_next_weekday.py
Created September 8, 2021 02:57 — forked from hanksudo/last_or_next_weekday.py
(Python) Find next weekday or last weekday
from datetime import timedelta
def next_weekday(date, weekday):
day_gap = weekday - date.weekday()
if day_gap <= 0:
day_gap += 7
return date + timedelta(days=day_gap)