$ uname -r
import os | |
import sys | |
import re | |
import boto3 | |
import zipfile | |
def parse_s3_uri(url): | |
match = re.search('^s3://([^/]+)/(.+)', url) | |
if match: | |
return match.group(1), match.group(2) |
import boto3 | |
ec2 = boto3.resource('ec2') | |
def lambda_handler(event, context): | |
# create filter for instances in running state | |
filters = [ | |
{ | |
'Name': 'instance-state-name', | |
'Values': ['running'] |
cloud-init
is absolute cancer. Its code is horrible. It has no documentation at all.
It took me 5 fucking hours to figure out how to properly configure networking on recent
cloud-init
(Ubuntu 16.04 cloud image
) with local datasource.
It's not mentioned anywhere you need to provide dsmode: local
. (but only if you need network-config,
besides that everything is fine; someone below noted that -m
flag does the same thing, good to know) Of course nobody needs documentation for network-config
format
either. (cloudinit/net/__init__.py
is a protip, enjoy the feces dive)
Oh, and by the way - no, it's not possible to provide network-config
to uvt-kvm
without patching shit.
This Cloud-init script can be used to bootstrap a Xen based CoreOS server through Xen orchestra.
Features;
- Workaround for the lack of /etc/environment on 'unsupported' hypervisors
- Static IP allocation to deal with dhcp causing problems (On my network at least)
- etcd2 bootstrap discovery using public service and discovery tokens
- Manual reconfiguration to allow for membership changes after cluster is operational
#!/bin/bash | |
DOMAINS=$1 | |
TMP_DIR=$2 | |
if [[ "$DOMAINS" == "" || "$TMP_DIR" == "" ]] ; then | |
echo -e "Usage : script.sh DOMAINS.txt (with one domain per line) TMP_DIR" | |
echo -e "Example : ./script.sh mydomains.txt /tmp" | |
exit 1 | |
fi |
disable_ec2_metadata: True | |
datasource_list: [ "ConfigDrive", "None"] | |
datasource: | |
None: | |
userdata_raw: | | |
#!/bin/bash | |
groupadd vagrant | |
useradd -d /home/vagrant -s /bin/bash -m -g vagrant -G wheel vagrant | |
echo "root:vagrant" | chpasswd |
#!/bin/bash | |
# Configuration for the script | |
POSTFIX_CONFIG=/etc/postfix/main.cf | |
POSTFIX_SASL=/etc/postfix/sasl_passwd | |
function confirm () { | |
read -r -p "${1:-Are you sure? [Y/n]} " response | |
if [[ $response == "" || $response == "y" || $response == "Y" ]]; then | |
echo 0; |
from collections import defaultdict | |
import boto3 | |
""" | |
A tool for retrieving basic information from the running EC2 instances. | |
""" | |
# Connect to EC2 | |
ec2 = boto3.resource('ec2') |