Setting up mysql replication to Amazon RDS

If you want to set up a replication between an RDS and an existing mysql server environment, you might encounter privilege errors, when trying to execute commands like "change master to…" or "stop slave;" on the RDS. Amazon RDS comes with a bunch of stored procedures that you have to use instead: MySQL Command Stored Procedure […]

Installing AWS Cloudformation Scripts on Debian Wheezy

First install needed packages: apt-get install python-pip python-yaml unattended-upgrades These packages are needed to build the AWS package: pip install pystache pip install argparse pip install python-daemon Now get the latest scripts from here: wget And install it: tar -xvpf aws-cfn-bootstrap-latest.tar.gz cd aws-cfn-bootstrap-1.4/ python build python install When the installation has finished successfully […]

Redirect AWS userdata output to log file

When using a userdata script in you Autoscaling launch configuration, by default if your script has some output, it will not be visible somewhere. With this simple script you can redirect the outpout to a log file: #!/bin/bash -ex source /etc/profile exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1 echo BEGIN #Your code comes […]

Grow ext4 or xfs partitions to its maximum size

For EXT4 partitions: resize2fs /dev/xvda1 For XFS: xfs_growfs -d /dev/xvda1 Replace xvda1 with the partition of your choice! I ran into this problem using AWS instances in which I had to increase the size of the root partitions of an EBS volume. Type df -h to show your currently mounted partitions and disk usage.

Calculating the size of your S3 bucket using Python

For the following script you need to have installed Python >= 2.6 and Boto: apt-get install -y python-boto Next create a file ~/.boto containing the following lines: [Credentials] region = us-east-1 aws_access_key_id = YOUR_ACCESS_KEY_ID aws_secret_access_key = YOUR_SECRET_ACCCESS_KEY Put in the AWS credentials to access your bucket Then create the script, replace NAME_OF_YOU_BUCKET with your actual […]

Backups to S3 using Duplicity

First install Duplicity with its dependancies: apt-get install haveged python-paramiko python-boto python-gobject-2 duplicity Then generate a gpg key: gpg −−gen-key The output might be like this (just confirm everything with return and keep aside the password you'll have to enter): gpg (GnuPG) 1.4.12; Copyright (C) 2012 Free Software Foundation, Inc. This is free software: you […]

Use s3ql to mount an S3 storage filesystem locally

s3ql is an alternative to s3fs and s3backer which you can use to mount and s3 bucket into your local filesystem. s3ql will create a block device inside your S3 bucket. Its size is dynamic, so you allocate just as much storage space as you are using. It also encrypts your data using a password […]

Installing AWS CLI on Debian

First install the Python package: apt-get install python python-pip Then issue the AWS CLI Installation: pip install awscli If all went ok, you should be able to execute for example aws configure which will help you to create an initial configuration file containing your credentials, region and output format. More help type aws help or aws ec2 […]