- wget https://s3.amazonaws.com/aws-cli/awscli-bundle.zip
- unzip awscli-bundle.zip
- sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Wednesday, 30 October 2013
Latest aws cli tools on Redhat
Wednesday, 23 October 2013
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
To encrypt the Ebs volume, add "Encrypted": true to the device params like so:
- 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" }]'
- '[{ "DeviceName":"/dev/sdb", "VirtualName":"ephemeral0" },{"DeviceName":"/dev/sdc","Ebs":{"VolumeSize":50}}]'
To encrypt the Ebs volume, add "Encrypted": true to the device params like so:
- {"DeviceName":"/dev/sdc","Ebs":{"VolumeSize":50,"Encrypted": true}}
Labels:
aws,
aws-cli,
block-device-mappings,
cli,
command line,
ebs,
encrypted,
ephemeral,
run-instances
Tuesday, 15 October 2013
Use rvm in cron
- rvm list
- find what looks like your gems set, e.g
- ruby-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-p194
- your 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 line
- hit ^D to end message and send
- you should be returned to shell
Saturday, 5 October 2013
Edit files on a remote server via your Mac using ssh, sshfs and brew
- install latest xcode
- install brew
- install sshfs using brew
- make sure to change any permissions specified
- mkdir mytmpdir
- sshfs -o uid=<your local numerical id> root@<remote server>:<remote dir> mytmpdir
- e.g. sshfs -o uid=501 root@10.1.0.100:images mytmpdir
- edit files that appear in tmpdir, and when you save them, the remote files will be updated
Unmount
- umount mytmpdir
Friday, 4 October 2013
Simple unbound upstart script
- put below in /var/tmp/unbound.conf
- pkill unbound
- lsof -nP -i :53
- pgrep unbound
- cp -v /var/tmp/unbound.conf /etc/init/
- start unbound
- status unbound
- status unbound
- start unbound
start on runlevel [3] expect fork exec unbound
Thursday, 3 October 2013
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?
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?
Tuesday, 1 October 2013
Create isolated bucket on S3
- setup
- create IAM group
- add simple, custom policy below
- do not add any other policies to group
- create IAM user and put in above IAM group
- create and download key and secret for user
- create bucket "mybucket01" in S3
- you don't have to touch perms of bucket itself
- client
- install s3fox addon for Firefox from www.s3fox.net
- older versions FAIL! get it only at www.s3fox.net
- open s3fox addon
- Firefox -> Tools -> S3 Organizer
- add only one user to "Manage Accounts" using user key and secret
- in 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", "Action": "s3:*", "Resource": [ "arn:aws:s3:::mybucket01", "arn:aws:s3:::mybucket01/*" ] } ] }
Labels:
bucket,
exclusive,
individual,
isolated,
s3,
single,
single user,
user
Snapshot AWS instance store as AMI
- install api-tools
- install ami-tools
- generate key / cert
- create IAM user
- upload cert
- java install / export JAVA_HOME
- export key and secret
- ec2-bundle-vol
- --user <AWS acct #>
- --privatekey /myhome/my-key.pem
- --cert /myhome/my-cert.pem
- --arch x86_64
- --destination /var/tmp
- --exclude
- /backup,
- /mnt,
- /swapfile
- ec2-upload-bundle
- --manifest /var/tmp/image.manifest.xml
- --bucket mybucket/hostname
- --access-key <AWS Key>
- --secret-key <AWS Secret>
- --location EU
- ec2-register
- --region eu-west-1
- --name "myaminame"
- --description "Backing up hostname"
- mybucket/hostname/image.manifest.xml
- 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/
Subscribe to:
Posts (Atom)
Interview questions: 2020-12
Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer Networking Layer 1 vs Layer 4 haproxy u...
-
kubectl --cert=/tmp/tls.crt --key=/tmp/tls.key create secret tls tls-wc-ingress
-
apt-get install exim4 dpkg-reconfigure exim4-config Select: internet site; mail is sent and received directly using SMTP IP-addresses...
-
brew install python3 mkdir -p ~/bin/python3 python3 -m venv ~/bin/python3 source ~/bin/python3/bin/activate enjoy!