Amazon EC2 API Delete Snapshot Script Fix
$30-250 USD
Pagado a la entrega
Hi,
I have a script that is suppose delete snapshots older than 60 days in aws that stopped working probably due to an amazon api update. The error is aws: error: argument --snapshot-id is required
I've pasted the script below.
#!/bin/bash
#export EC2_PRIVATE_KEY=****
#export EC2_CERT=****
#export EC2_URL=****
#export AWS_ACCESS_****
#export AWS_SECRET_KEY=****
#export REGION=****
#export EC2_HOME=/opt/aws/apitools/ec2
#export JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64
MAILADDR=****
DIR="/root/scripts"
CURRENT_DATE=$(date +%Y-%m-%d);
# We now prunning backups older than 60 days
aws ec2 describe-snapshots | grep `date +%Y-%m-%d --date '60 days ago'` | awk {'print $2'} > $DIR/[login to view URL]
LIST=`cat $DIR/[login to view URL] | wc -l`
if [ $LIST -eq "0" ]; then
echo "No snapshots older than 60 days have been found on your server." | mail -s "Deleted Snapshots notification - $CURRENT_DATE" -r reports@**** $MAILADDR
exit
else
echo "Deleted Snapshots:" > $DIR/[login to view URL]
echo "" >> $DIR/[login to view URL]
for i in `cat $DIR/[login to view URL]`
do
aws ec2 delete-snapshot $i
echo $i : Deleted >> $DIR/[login to view URL]
done
#cat $DIR/[login to view URL] | mail -s "Deleted Snapshots notification - $CURRENT_DATE" -r reports@**** $MAILADDR
fi
aws: error: argument --snapshot-id is required
Nº del proyecto: #17803521
Sobre el proyecto
Adjudicado a:
hello i will change the coding to get the error fixed and the snapshots older than 60 days would be deleted.. please message me back to discuss details and i am ready to get started..
11 freelancers están ofertando un promedio de $110 por este trabajo
hi, Looking to your bash scripts, there are something incorrect - If your run aws ec2 describe-snapshots | grep `date +%Y-%m-%d --date '60 days ago'` | awk {'print $2'} it just displays the snapshort created ti Más
Hello I am working in Scripting technologies for years. I worked in various Unix Shells (c shell, bash korn), perl and python. Can we talk further on this? Thank you!
I have been in this field for more than 7 years. I have experience in C#, PHP, Perl,LARAVEL, WordPress, Html, Postgres, Python, Ubuntu, Crontab, Web Services, Xero, Rest API, Zend, AWS API Gateway, Lambda, AWS Server, Más
I have a script do the same work with you, can fix your script within 1 day, please help share what your snapshot look like first, i also need permission access snapshot in AWS
I can give you a new script to delete the snapshot based on retention period(how many days you want to search for eg: 60 days)