Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to store jks certificate in AWS Secret Manager

I need to securely store and fetch keystore.jks and truststore.jks files from my Java application in order to make secure communications with external application.

Can we store these files in AWS Secret Manager?

I am not able to find proper documentation to store JKS certificate as secret in AWS secret manager.

like image 527
dc9211 Avatar asked Jul 26 '20 08:07

dc9211


2 Answers

You would store these as binary secrets in SecretsManager, as long as they are under the size limit. Alternatively, you could store them in a private S3 bucket encrypted with a KMS CMK.

Since Java expects the truststore.jks and keystore.jks files to be present on the file system before the Java application starts up, you would need to script your docker container to download the files into the running container before starting your Java application, for example by including and using the AWS CLI tool within your Docker image.

To give your ECS application access to download the files you would assign the appropriate IAM permissions to the ECS task.

like image 199
Mark B Avatar answered Sep 19 '22 18:09

Mark B


You can add and retrieve certificates from AWS Secret Manager. But it depends on the size of your certificate as well. Read here : Quotas for AWS Secrets Manager

Secrets for AWS Secrets Manager have various limits such as length in characters (65,536).

Read the docs : Storing the certificates in AWS Secrets Manager

Note : You will need to use HTTP Resolvers/ Lambda Resolvers to be able to make http calls to AWS Secrets Manager to obtain the secret.

like image 41
Amit kumar Avatar answered Sep 19 '22 18:09

Amit kumar