I'm really new to AWS ELB and I'm reading about how to automatically mount an EBS volume from a snapshot via the ebextensions script. I've found this post as a reference: https://aws.amazon.com/blogs/devops/customize-ephemeral-and-ebs-volumes-in-elastic-beanstalk-environments/
But basically, my question is, how do I set in the option settings to have it automatically pull the latest snapshot id? Because the snapshots will be updated daily, and I only want to get the latest snapshot without having to edit the ebextensions script each time.
This is what I'm thinking the ebextensions script will be:
commands:
01mkdir:
command: "mkdir /mnt/ebs_snapshot"
02mount:
command: "mount /dev/sdh /mnt/ebs_snapshot"
option_settings:
- namespace: aws:autoscaling:launchconfiguration
option_name: BlockDeviceMappings
value: /dev/sdh=(how to put latest snapshot id?)
I also found this post: http://www.commandlinefu.com/commands/view/13514/find-the-most-recent-snapshot-for-an-aws-ebs-volume
But not sure how to incorporate that into the ebextensions script file...
It's not possible to dynamically specify the block device mappings within the
.ebextensions
.Instead, you'll need to create your own script to:
/dev/sdh
,This script you can create/specify within the
files
andcommands
seconds of the.ebextensions
files.