CaseyLabs / aws-ec2-ebs-automatic-snapshot-powershell

Powershell script for Automatic EBS Snapshots and Cleanup on Amazon Web Services (AWS). Created by CaseyLabs.
http://www.caseylabs.com
GNU General Public License v2.0
25 stars 19 forks source link

Add Drive Letter To Snapshot Description #5

Closed jboeshart closed 9 years ago

jboeshart commented 9 years ago

I've added some functionality that will add the drive letter of the volume being snapshotted to the description, making it a bit easier to identify the exact EBS volume in the event you need to recover a snapshot. I've tested this in my AWS account and it works good, let me know if there's additional validation you'd want to see. Much of this code is pulled from a script in the AWS documentation, but modified slightly to fit in with these scripts.

I also had to add the ec2:DescribeInstances permission to the policy in order for this to work, since the additional code calls Get-EC2Instance to enumerate the block device mappings. I don't think there's any more restrictive permissions to give, but let me know if there is another one we could use.

Great set of scripts by the way!

Thanks! Jason

jboeshart commented 9 years ago

So, hang tight on this one as I'm seeing some inconsistencies that I'm trying to track down. On some servers it's adding in the volume letter, and on others it's not and I'm not entirely sure why. Not sure if it's something specific to my environment or if there's something in the script that isn't quite right, but I'm looking in to it.

jboeshart commented 9 years ago

Ok, I was able to track it down to some customization that I'm doing to automate the rollout of this through Chef, so as far as I can test this commit should be good to go, but you might want to do some testing of it on your own to be sure. I also added an additional commit, as the script was erring out if the server was using an IAM role instead of an IAM user. The command to populate $volume_list wasn't executing successfully because no region was specified. This additional commit adds the --region $region option to the command.

CaseyLabs commented 9 years ago

Alrighty, finally catching up on my outstanding pull requests. Just did a quick review of this request on a Win2008 R2 instance, and everything looks good from the snapshots created. Consider this merged... thanks again for the contribution!