https://github.com/theburningmonk/prsls-trint/
-
In step 4, to export the outputs:
npx sls export-env --all
-
In step 6, to debug the search-restaurants page locally, install https://github.com/jeremydaly/serverless-cloudside-plugin
npm i --save-dev serverless-cloudside-plugin
-
In step 12, how you might create the param:
-
Create the SSM Parameters
for x in get search; do aws ssm put-parameter --region $AWS_REGION --type String --tags Key=Owner,Value=$SLS_STAGE --name /mod03/$SLS_STAGE/$x-restaurants/config --value '{"defaultResults": 8}' done
-
If you need to update a key:
aws ssm put-parameter --region $AWS_REGION --type String --name /mod03/$SLS_STAGE/search-restaurants/config --value '{"defaultResults": 8}' --overwrite
-
-
For step 13
-
Create the KMS key
aws kms create-key --description "$SLS_STAGE's key" --tags TagKey=Name,TagValue=$SLS_STAGE --region $AWS_REGION | tee KmsKey.json
-
Put the Key ARN into param store
aws ssm put-parameter --region $AWS_REGION --tags Key=Owner,Value=$SLS_STAGE --type String --name /mod03/$SLS_STAGE/kmsArn --value "$(jq -Mr '.KeyMetadata.Arn' KmsKey.json)"
-
Then use the
KeyId
from above to set the value of the param:aws ssm put-parameter --region $AWS_REGION --type SecureString --tags Key=Owner,Value=$SLS_STAGE --key $(jq -Mr '.KeyMetadata.KeyId' KmsKey.json) --name /mod03/$SLS_STAGE/search-restaurants/secretString --value "this isn't really a secret"
-
Delete the keys
for x in get search; do aws ssm delete-parameter --region $AWS_REGION --name /mod03/$SLS_STAGE/$x-restaurants/config done
-
Delete KMS key
aws kms disable-key --region $AWS_REGION --key-id $(jq -Mr '.KeyMetadata.KeyId' KmsKey.json) aws kms schedule-key-deletion --region $AWS_REGION --key-id $(jq -Mr '.KeyMetadata.KeyId' KmsKey.json) --pending-window-in-days 7
-