Posts

Showing posts from October, 2013

Latest aws cli tools on Redhat

wget https://s3.amazonaws.com/aws-cli/awscli-bundle.zipunzip awscli-bundle.zipsudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws  Result is in /usr/local/bin, so set up your PATH accordingly.

aws cli run-instances block-device-mappings ephemeral encrypted

aws --version => aws-cli/1.1.1 Python/2.6.8 Linux/3.4.43-43.43.amzn1.x86_64
aws ec2 run-instances --image-id ami-eeff1122 --instance-type m2.2xlarge --security-group-ids sg-eeff1122 --subnet-id subnet-eeff1122 --private-ip-address 10.0.0.2--user-data file://meta_myserver.txt --block-device-mappings '[{ "DeviceName":"/dev/sdb", "VirtualName":"ephemeral0" }]' For 50G EBS attached on boot (auto-deleted on terminate unless you override), block device mapping becomes:
 '[{ "DeviceName":"/dev/sdb", "VirtualName":"ephemeral0" },{"DeviceName":"/dev/sdc","Ebs":{"VolumeSize":50}}]' WARNING: "Ebs" is very case sensitive here.

To encrypt the Ebs volume, add "Encrypted": true to the device params like so:
 {"DeviceName":"/dev/sdc","Ebs":{"VolumeSize":50,"Encrypted": true}}

Use rvm in cron

rvm listfind what looks like your gems set, e.gruby-1.9.3-p194 echo $rvm_path/bin, e.g./usr/lib/rvm/bin tack on the output of #1 to the output of #2, e.g./usr/lib/rvm/bin/ruby-1.9.3-p194your cron entry should be the result of #3 followed by your ruby script, e.g.0 0 * * * /usr/lib/rvm/bin/ruby-1.9.3-p194 /optt/mydir/myscript.rb

Test exim from CLI without "mail" command

If you don't have "mail" on the CLI for whatever, weird (Redhat-based) reasons, circumvent like so:
/path/to/exim -v 'user@domain'type a multi-line message here ending with blank linehit ^D to end message and sendyou should be returned to shell Taken: http://atmail.com/kb/2008/testing-email-with-exim/

Edit files on a remote server via your Mac using ssh, sshfs and brew

install latest xcodeinstall brewinstall sshfs using brewmake sure to change any permissions specified mkdir mytmpdirsshfs -o uid=<your local numerical id> root@<remote server>:<remote dir> mytmpdire.g. sshfs -o uid=501 root@10.1.0.100:images mytmpdiredit files that appear in tmpdir, and when you save them, the remote files will be updated Unmount umount mytmpdir

Simple unbound upstart script

put below in /var/tmp/unbound.confpkill unboundlsof -nP -i :53pgrep unboundcp -v /var/tmp/unbound.conf /etc/init/start unboundstatus unboundstatus unboundstart unboundstart on runlevel [3] expect fork exec unbound

Sanity of growing a stripped LVM volume

Quote:

However, with LVM you can easily grow a logical volume. But, you cannot use stripe mapping to add a drive to an existing striped logical volume because you can’t interleave the existing stripes with the new stripes. This link explains it fairly concisely.

    “In LVM 2, striped LVs can be extended by concatenating another set of devices onto the end of the first set. So you can get into a situation where your LV is a 2 stripe set concatenated with a linear set concatenated with a 4 stripe set.”

Taken: Pick Your Pleasure: RAID-0 mdadm Striping or LVM Striping?

Create isolated bucket on S3

setupcreate IAM groupadd simple, custom policy below do not add any other policies to groupcreate IAM user and put in above IAM groupcreate and download key and secret for usercreate bucket "mybucket01" in S3you don't have to touch perms of bucket itself clientinstall s3fox addon for Firefox from www.s3fox.netolder versions FAIL! get it only at www.s3fox.netopen s3fox addonFirefox -> Tools -> S3 Organizeradd only one user to "Manage Accounts" using user key and secretin right-hand window of s3fox add "/mybucket01" NOT "/""/" will give you "Access Denied"because user does not have perms to list root buckets, only itself { "Statement": [ { "Effect": "Allow", "Action": "s3:ListAllMyBuckets", "Resource": "arn:aws:s3:::mybucket01" }, { "Effect": "Allow", …

Snapshot AWS instance store as AMI

install api-toolsinstall ami-tools generate key / certcreate IAM user upload cert java install / export JAVA_HOMEexport key and secretec2-bundle-vol --user  <AWS acct #> --privatekey /myhome/my-key.pem--cert /myhome/my-cert.pem--arch x86_64--destination /var/tmp--exclude/backup,/mnt,/swapfileec2-upload-bundle--manifest /var/tmp/image.manifest.xml--bucket mybucket/hostname--access-key <AWS Key>--secret-key <AWS Secret>--location EUec2-register--region eu-west-1--name "myaminame"--description "Backing up hostname"mybucket/hostname/image.manifest.xml Taken:
http://www.dowdandassociates.com/content/howto-create-an-instance-store-backed-amazon-ec2-ami/http://www.dowdandassociates.com/content/howto-install-aws-cli-amazon-elastic-compute-cloud-ec2-ami-tools/http://www.dowdandassociates.com/content/howto-install-aws-cli-amazon-elastic-compute-cloud-ec2-api-tools/ NOTE: the above link's content has typos in very essential parts, proof all steps