Fullført

Amazon EC2 API Delete Snapshot Script Fix

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

Ferdigheter: Amazon Web Tjenester, Bash Scripting, Linux

Se mer: aws ec2 describe-snapshots example, aws delete unused snapshots, ec2-describe-snapshots sort by date, aws delete all snapshots, aws ec2 delete snapshot all, aws automatically delete old snapshots, aws snapshot cleanup script, aws delete snapshots older than 30 days, amazon ec2 creating windows server 2003 ami, script php amazon apicj api, amazon ec2 script launch instance attach volume, script amazon associates api, amazon soap api script, java sample program amazon ec2 soap api, amazon xml api script, amazon ec2 rest api, implement rest api amazon ec2, script amazon advertising api, amazon shopping api script website, amazon store api php script

Om arbeidsgiveren:
( 155 omtaler ) Vancouver, Canada

Prosjekt-ID: #17803521

Tildelt til:

yashaswini510

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..

$50 USD på 1 dag
(129 omtaler)
5.7

12 frilansere byr i snitt $113 for denne jobben

dirisalagopal

Amazon web services expert

$49 USD på 1 dag
(22 Omtaler)
4.4
greenforest0204

hi i am very interested in your post project. i have rich experience on it. so i am sure i can give you good result in time. please call me Dmitrii. looking forward your reply. thanks regards

$155 USD på 3 dager
(1 anmeldelse)
4.4
deytps86

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!

$220 USD på 3 dager
(5 Omtaler)
3.7
awsdevopro

Hi, Currently I'm a full time employer at [login to view URL] (In-House software farm) where my position is DevOps, providing lifetime support for [login to view URL] ,ERP, [login to view URL], [login to view URL], [login to view URL] Mer

$155 USD på 3 dager
(5 Omtaler)
3.4
mtriettruong

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 Mer

$94 USD på 1 dag
(8 Omtaler)
3.2
Vincend

I specialize in Linux administration and internet technologies. I have been assisting companies to meet their technology needs for more than 14 years, and I have over 20 years of IT experience on a global scale. I Mer

$155 USD på 1 dag
(5 Omtaler)
3.3
rabhardwaj

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, Mer

$122 USD på 1 dag
(7 Omtaler)
3.8
iforno

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

$55 USD på 3 dager
(1 anmeldelse)
1.1
Chaitanya1227

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)

$166 USD på 1 dag
(0 Omtaler)
0.0
gogovel

Hello, It seems the describe-snapshots command returns different output and later the delete command fails because of that (can't find snapshot id). I can quickly fix the script and demonstrate it to you on may env. Mer

$40 USD på 1 dag
(0 Omtaler)
0.0
SIOD

Hi Mate, I am AWS certified Associate and can sort you out this snapshot deletion issue quick. Please let me know if you are interested. Relevant Skills and Experience AWS Certified Associate, working in AWS project Mer

$100 USD på 3 dager
(0 Omtaler)
0.0