# describe snapshots and sort by date
ec2-describe-snapshots -C cert.pem -K key.pem | sort -k 5
# delete all but current month (not the last 30 days)
ec2-describe-snapshots -C cert.pem -K key.pem | grep -v $(date +%Y-%M-) | awk '{print $2}' | xargs -n 1 -t ec2-delete-snapshot -K key.pem -C cert.pem
Tuesday, October 30, 2012
Ec2 (aws) - delete snapshots
Ec2 snapshots are a way to make backups of your data into the amazon cloud.
To do snapshots you will need the ec2-api-tools, your access key and secret or the x509 certificates for your aws account.
Obviously after you snapshot you will need eventually to delete snapshots that you don't need anymore. This example shows how to use the ec2-api-tools into a shell to delete snapshots that are not part of the current month.
You can have a cronjob that runs every last day of the month, this will give you almost 30 days of snapshots.
Friday, October 19, 2012
Couchbase recover web console password
You will need to have access to the config.dat file that resides onto the couchbase server (can be any of them if is into a cluster).
There you go
username : Administrator
password : Administrator
/opt/couchbase/bin/erl \
-noinput -eval \
'case file:read_file("/opt/couchbase/var/lib/couchbase/config/config.dat") of {ok, B} -> io:format("~p~n", [binary_to_term(B)]) end.' \
-run init stop | grep cred
{rest_creds,
{creds,[{"Administrator",[{password,"Administrator"}]}]}]},
username : Administrator
password : Administrator
Tuesday, October 2, 2012
Puppet install rpms via http sources
The redhat package manager - rpm has the capability to install packages
from an url. As simple as
rpm -ivh http://example.com/package.rpm
Taking this in consideration we can use this into puppet to install packages
from an url.
Save this text as test.pp
class examplerpm ( $src ) {
package { 'package':
provider => 'rpm',
ensure => installed,
source => "${examplerpm::rpm}"
}
}
class { 'examplerpm':
src => 'https://example.com/package.rpm',
}
Apply the manifest with puppet
puppet apply --debug --no-daemonize test.pp
Voila - the package is installed via puppet->rpm provider.
The key to all this is to specify the provider into the Package section of
examplerpm class. This ensures that rpm will go fetch the source and installs
it.
Labels:
amazon,
automation,
devops,
puppet,
rpm
Subscribe to:
Posts (Atom)