Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up local AWS Secrets Manager Docker container for local testing purposes?

I'm looking to set up a local Docker instance of AWS Secrets Manager.

I've been scouring the web for an image or anything of the sort that I can use. I can only find documentation for AWS ECS secrets management.

Does anyone have any experience with setting up AWS Secrets Manager for local testing through Docker? Thanks!

like image 642
Bbbbob Avatar asked Jul 22 '19 21:07

Bbbbob


People also ask

How do I access AWS Secret manager locally?

AWS Secrets Manager is supported at http://localhost:4584 by default.

Is AWS secrets manager multi region?

AWS Secrets Manager now enables you to replicate secrets across multiple AWS Regions. You can now give your multi-Region applications access to replicated secrets in the corresponding Regions and rely on AWS Secrets Manager to keep the replicas in sync with the primary secret.


2 Answers

Good question!
You could run localstack [1] inside a docker container. It mocks some of the AWS services for testing purposes. AWS Secrets Manager is supported at http://localhost:4584 by default.
There are some useful blog posts covering localstack. [2][3]

However, I could not find any blog post covering AWS Secrets Manager on localstack. I guess you have to try it out yourself.

References

[1] https://github.com/localstack/localstack
[2] https://medium.com/@andyalky/developing-aws-apps-locally-with-localstack-7f3d64663ce4
[3] https://medium.com/pareture/localstack-for-local-aws-dev-22775e483e3d

like image 59
Martin Löper Avatar answered Oct 14 '22 03:10

Martin Löper


You can setup local AWS SecretManager inside LocalStack using the following command:

aws --endpoint-url=http://localhost:4566 secretsmanager create-secret --name my_secret --secret-string [{"my_uname":"username","my_pwd":"password"}]

Output:

{
    "ARN": "arn:aws:secretsmanager:us-east-1:000000000000:secret:my_secret-denusf",
    "Name": "my_secret",
    "VersionId": "e168cdf1-5c94-493d-bafd-791779a7515d"
}
like image 30
Rajneesh Aggarwal Avatar answered Oct 14 '22 03:10

Rajneesh Aggarwal