I've the following setup:
- Infrastructure is setup using AWS CDK;
- I've one Stack/Environment (Production, Staging...);
- Each Stack has a different S3 Bucket (used for website hosting);
- I've a Stack that creates an IAM User (used by CI/CD);
- CI/CD in this case is GitHub Actions (deploy every time a merge to
main
happens);
- The IAM User has only put rights to all the Buckets (deploy means put the assets in the Bucket);
What is the best way to store/handle the keys for that user?
I started printing it in the Outputs but it is not secure. Everyone can see it (if they've access to the logs of CI/CD for example).
I've been suggested to store them in SSM: it works but you can't create it as SecureString so it would be just a String.
I've also taken a look into Secrets Manager: it also works and seems to be more secure (not sure if my feeling here is valid though).
Any ideas/opinions here?
Thanks!
In the code it looks something like:
// Production Stack
const bucket = new Bucket(this, "Bucket", {
bucketName: "production",
});
// Staging Stack
const bucket = new Bucket(this, "Bucket", {
bucketName: "staging",
});
// IAM Stack
const user = new User(this, "User", {
userName: "ci-cd-user",
});
const userAccessKey = new AccessKey(this, "UserAccessKey", { user });
// This is just an example, I go through all the available Buckets
bucketProduction.grantPut(user);
bucketStaging.grantPut(user);