Skip to content

Instantly share code, notes, and snippets.

View skorfmann's full-sized avatar

Sebastian Korfmann skorfmann

View GitHub Profile
@skorfmann
skorfmann / Readme.md
Last active November 27, 2023 00:39
Private Api Gateway in CDK.

Private API Gateway with the AWS CDK

  • Lambda
  • Private Api Gateway
  • VPC Endpoint

NB: In order to access the Api Gateway through the public DNS of the VPC endpoint, a curl request has to have the api id as header. See also here

curl -i -H "x-apigw-api-id: " https://vpce-.execute-api..vpce.amazonaws.com/

Both things have been introduced recently, and let you access even private ec2 instances

  1. Without VPN
  2. No open SSH port
  3. Authentication / Authorization is fully delegated to IAM
# Assumes valid AWS Credentials in ENV
require 'dnsimple'
require 'platform-api'
namespace :staging do
desc "create subdomain DNS record for Heroku review app"
task :publish_dns do
heroku_app_name = ENV['HEROKU_APP_NAME']
heroku_app_name =~ /.*(pr-\d+)/
subdomain = $1
shared_examples 'included before filter' do |expected_filter, actions|
controller do
skip_filter *_process_action_callbacks.map(&:filter).reject {|filter| filter == expected_filter }
actions.each do |action|
define_method(action) do
render nothing: true
end
end
end
alias rs='rails server'
alias rc='rails console'
alias rg='rails generate'
alias r='ruby'
alias be='bundle exec'
alias gst='git status' # Show the status
alias gl='git pull --rebase' # Pull rebase
alias gp='git push' # Push
alias gu='git up' # Push

Howto Reset etcd discovery

Every time my test cluster is going down, I was struggeling with etcd autodiscovery failing. This looks probably familiar to you:

The Problem

systemd[1]: Starting etcd...
systemd[1]: Started etcd.
etcd[3066]: [etcd] Apr  9 08:31:42.512 INFO      | Discovery via https://discovery.etcd.io using prefix /<TOKEN>.
@skorfmann
skorfmann / Gemfile
Created April 9, 2014 06:39
A super simple Sinatra API to expose the status of a unit / job within a CoreOS cluster.
source "https://rubygems.org"
gem 'sinatra'
gem 'etcd'
group :development do
gem 'rake'
gem 'rspec'
gem 'rack-test'
gem 'shotgun'