@dotsec/plugin-aws
Requirements
- AWS CLI
- AWS credentials configured with the following permissions:
kms:CreateKeykms:CreateAliaskms:Encryptkms:Decryptkms:DescribeKeykms:ListAliases-
kms:ListKeys -
Permissions needed for SSM Parameter Store:
ssm:GetParameterssm:GetParametersssm:PutParameter-
ssm:DeleteParameter -
Permissions needed for Secrets Manager:
secretsmanager:CreateSecretsecretsmanager:DeleteSecretsecretsmanager:GetSecretValuesecretsmanager:ListSecretssecretsmanager:PutSecretValue
TODO: validate permissions
Installation
npm install dotsec @dotsec/plugin-aws
Create dotsec.config.ts
npx dotsec --plugin @dotsec/plugin-aws aws init
Create a KMS key and alias
If you don't have an AWS KMS key with an alias, you can create one with the following command:
aws kms create-key --description "Dotsec key" --region eu-west-1
Take not of the KeyMetadata.KeyId value, and create an alias for it:
Note: You are free to pick any allowed alias name, just make sure to specify the alias in one of the following:
dotsec.config.ts>defaults.plugins.aws.kms.keyAlias--aws-key-aliasoptionAWS_KMS_KEY_ALIASenvironment variable
aws kms create-alias --alias-name alias/dotsec --target-key-id <key-id>
Encrypt a .env file to .sec
npx dotsec encrypt
Decrypt a .sec file to.env
npx dotsec decrypt
Commands
init
npx dotsec --plugin @dotsec/plugin-aws aws init