Skip to content

Instantly share code, notes, and snippets.

View chiradeep's full-sized avatar

Chiradeep Vittal chiradeep

View GitHub Profile
@chiradeep
chiradeep / gist:10442766
Created April 11, 2014 05:46
Patch to get AWS Ruby SDK v1.34.1 working with Apache CloudStack awsapi module v4.2.1
--- aws-sdk-1.34.1-original/lib/aws/core/client.rb 2014-04-10 22:07:31.722036263 -0700
+++ aws-sdk-1.34.1/lib/aws/core/client.rb 2014-04-10 22:10:49.538138111 -0700
@@ -551,6 +551,9 @@
http_request.service_ruby_name = service_ruby_name
http_request.host = endpoint
http_request.port = port
+ if AWS.config.respond_to?("#{service_ruby_name}_service_path")
+ http_request.uri = config.send(:"#{service_ruby_name}_service_path")
+ end
http_request.region = @region
@chiradeep
chiradeep / provision.rb
Created April 29, 2014 18:05
Ruby script to ssh into base wheezy template and install stuff necessary for systemvm
#!/usr/bin/env ruby
require 'rubygems'
require 'net/ssh'
host = ''
user = 'root'
pass = 'root'
options = {}
opt_parser = OptionParser.new do |opts|
opts.banner = "Usage: provision.rb IP [options]"
@chiradeep
chiradeep / cfgdiff.py
Created June 5, 2014 06:02
Python script to diff 2 global configurations in CloudStack
# This script takes 2 json files as input. The json file describes the global configuration of a CloudStack installation
# To generate a json file of the configuration, use cloudmonkey:
#
# cloudmonkey -c staging.cfg
# > set display json
# > exit
# cloudmonkey -c production.cfg
# > set display json
# > exit
# cloudmonkey -c staging.cfg list configurations > staging.json
Verifying myself: My Bitcoin username is +chiradeep. https://onename.io/chiradeep
@chiradeep
chiradeep / gist:c66f0e61774a8f62546d
Created May 18, 2015 05:47
Non-working terraform
provider "cloudstack" {
api_url = "http://localhost:8080/client/api"
api_key = "tZTPtxAfbZfTrIiIDe4XHfZupjlCoVYy3JnIfvlqyxWvHbVJ9TDw8UWxQ_INj6r5NWGglLMYHX4hN33sMuoI1g"
secret_key = "9u1bizzTQrfhnp3Y_Cs-Zu9uiOr-nAmRcN5Eo6Pp8dlbeKgq_V0TqUqhDdDGgrXFqzT8yZ731UUPTPDeFKLzzQ"
}
resource "cloudstack_vpc" "default" {
name = "test-vpc"
display_text = "test-vpc"
cidr = "10.0.0.0/16"
@chiradeep
chiradeep / cloudwatch_riemann_1.clj
Created January 9, 2014 23:11
Riemann configuration to generate notifications like CloudWatch Alarms
(streams
(where (not (expired? event))
;; over time windows of 3 seconds...
(fixed-time-window 3
;; calculate the average value of the metric and emit an average (summary) event
(combine folds/mean
;; if there are no events in the window, we can get nil events
(where (not (nil? event))
#(info "average event" %)
@chiradeep
chiradeep / cloudwatch_riemann_2.clj
Created January 9, 2014 23:24
Riemann function for threshold crossing alerts
(defn tc [wndtime numwnds threshold & children]
(fixed-event-window wndtime
(combine folds/mean
(moving-event-window numwnds
(combine folds/minimum
(where (> metric threshold)
;;create a threshold crossing event
(with {:host nil :state "threshold crossed" :description (str "service crossed the value of " threshold " over " numwnds " windows of " wndtime " seconds")}
(apply sdo children)))))))
)
@chiradeep
chiradeep / postinstall_lxc.sh
Created April 29, 2014 00:48
post-install for a debian wheezy lxc container that installs stuff necessary for a systemvm
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#!/bin/bash
set -x
install_docker() {
curl -fsSL https://get.docker.com/ | sh
systemctl start docker
}
install_etcd() {

Integrate a Next Gen Firewall with Citrix NetScaler VPX in AWS

Overview

Quickly deploy a single tier webserver farm solution integrating the Citrix NetScaler loadbalancer and a Next Generation firewall. Solution components include:

  • a CloudFormation template (vpc_2azs.json) to deploy a VPC across 2 zones. There are 2 subnets in each zone: a Public Subnet and a Private Subnet. Internet facing appliances such as the NetScaler and NG FW are deployed in the Public Subnet while the web server farm is deployed in the private subnet.
  • a CloudFormation template (ns.1nic.json) to deploy a single NetScaler VPX appliance in the Public Subnet in one zone
  • a CloudFormation template (webservers.json)to deploy 2 web servers in the Private Subnet in the same zone as the NetScaler VPX
  • a CloudFormation template (pa-fw.json) to deploy a single Next Gen Firewall (Palo Alto VM Series) in the Public Subnet with a network interface in the Private Subnet (same zone as above).