aem-aws-stack-builder
aem-aws-stack-builder copied to clipboard
Persist backup snapshot ID in launch config
After nightly and hourly snapshot process of publish instance, snapshot/volume ID needs to be persisted in launch config, to be consumed by new publish instances launched during autoscaling event.
This is to ensure that in the event of losing all publish instances (i.e. there's no healthy publish instance to take snapshot from), the new instances will restore the latest nightly or hourly snapshot.
Note that there's a risk of corrupted repository in the hourly snapshot, hence we need to make this option configurable (whether to use hourly or nightly snapshot). Different users will take different level of risk of encountering corrupted repository.
First thing we'll need is an aws-tools python script to attach a snapshot ID to a launch configuration's snapshot ID (launchconfig is setup in this CF for publish layer https://github.com/shinesolutions/aem-aws-stack-builder/blob/master/cloudformation/apps/publish.yaml#L110).
This script should accept the following arguments:
- snapshot ID
- component
- stack prefix
The component and stack prefix can then be used to identify the launch config. The snapshot ID should then be set on that launch config.