Secrets Manager: backup?

Last Friday a dev asked me an interesting question:

  • Hey, do you have a backup of the secrets in secrets Manager?
  • …what do you mean?
  • yeah, in case I make some bad whoopsie

I ended up giving him r/w permissions for /dev/* only, but I quickly Googled around and I couldn’t really find anything for a scenario where a batch script deletes or updates everything by mistake.
Am I missing anything?

Secrets manager comes with a deletion window of minimum 7 days like KMS. During this period, access to the secret is blocked, and can be restored with an API call.

https://docs.aws.amazon.com/secretsmanager/latest/userguide/manage_delete-secret.html

Previous versions are also maintained, and can be viewed with other API calls:

https://docs.aws.amazon.com/cli/latest/reference/secretsmanager/list-secret-version-ids.html

https://docs.aws.amazon.com/cli/latest/reference/secretsmanager/get-secret-value.html

You could do it many ways, but maybe safest is to trigger a lambda on change of any secret to store all secrets/values in a s3 file for example.. make sure it’s private though lol. Any other triggers and storages are valid, and you can even implement a rollback from a file if you want to.. not the best safety-wise, but curious as to any other solutions folks could have

This sounds like a huge hole / cop out…

AWS secret manager has now a feature to replicate secrets to multiple regions which is useful in your use case as backup for Disaster recovery.
More details here

https://aws.amazon.com/blogs/security/how-to-replicate-secrets-aws-secrets-manager-multiple-regions/

You can put encryption, restrict access via IAM and Bucket ACLs. Please elaborate!

Why wouldn’t you just store it in S3 at that point with deletion off?

Wouldn’t storing the secrets in s3 kind of defeats the purpose of secrets manager?

Because it’s more convenient to access via secrets api (integration with ECS env vars etc). This is just storing a history of the state of secrets, which could be important if you don’t realize it before the end of the default 7 days of secret deletion window.

I understood the need was to store a history of secrets. Not going to store the history in another secret lol

You could… but then you are doing all of the heavy lifting - btw - I’m not knocking you here - this is a reasonable solution in the absence of Secrets Manager backup solution. What I’m saying is that Secrets Manager should have backups from day 0 before being released half assed and called ‘Enterprise’

don’t double down on this. find out how secrets manager already handles this

You can have a deletion window ,so in case is deleted you can restore it.
In addition you can :

  • Add a config rule to notify you if a secret is delete.
  • Replicate to another region.