Overriding storage configuration on an ephemeral EC2?

I’m currently building out AWS cloud infrastructure to migrate a high-traffic blog from WordPress to Ghost 4.7.

One of the requirements is that we use an S3 storage adapter for images. This is because we need to be able to regularly terminate the EC2 instance and spin up a new one automatically for security and availability purposes.

The problem is that ghost install does not provide arguments for the storage config object. Running ghost config --help shows arguments for all kinds of options, but none for the storage object.

This makes it impossible to properly configure the storage adapter during bootstrapping in the EC2 userdata without gross hacks.

Perhaps it would be better to bake a working, fully-configured Ghost installation into a custom AMI. We tried this approach, but the problem is that if we reprovision the RDS database, the database host URL in the config is no longer valid. There are enough dynamic configuration values that introduce the same problem. One solution would be to essentially decouple the configuration from the instance, which does not currently seem possible.

It would be ideal if we could simply install Ghost without any configuration file, without starting it or running doctor etc, then drop the config file in and start up the blog. Or, maybe there is a better approach?

Does anyone have experience hosting Ghost CMS on an ephemeral EC2 infra, where terminating/spinning up new instances can happen regularly and automatically?