Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Systems Manager Parameter store #21

Open
kikobr82 opened this issue Apr 15, 2020 · 6 comments
Open

Systems Manager Parameter store #21

kikobr82 opened this issue Apr 15, 2020 · 6 comments
Assignees

Comments

@kikobr82
Copy link
Contributor

Objectives:

  • generate 4 empty keys to store wordpress secrets
    • /wordpress/WORDPRESS_DB_HOST
    • /wordpress/WORDPRESS_DB_USER
    • /wordpress/WORDPRESS_DB_PASSWORD
    • /wordpress/WORDPRESS_DB_NAME
  • use aws managed key to encrypt values for these keys. Do it manually through AWS console
  • make sure to use same values when configuring wordpress image

Acceptance Criteria:

  • All values in parameter store are encrypted
  • My ec2 instance can get the values from the Parameter Store
@deniseddi deniseddi self-assigned this Apr 18, 2020
@deniseddi deniseddi self-assigned this Apr 19, 2020
@deniseddi
Copy link
Contributor

deniseddi commented Apr 21, 2020

To generate 4 keys to store wordpress secrets:

  • Created four aws ssm parameter resource through Terraform.

    • A parameter is a key-value pair for any data that you want to store and reference. You need to specify a name, data type and value for the parameter.
  • To store an encrypted value:

    • set parameter type to “SecureString”
    • used the default SSM KMS key
  • Run terraform init, plan, apply.

  • To comply with testing requirements, I’ve created an EC2 instance through terraform and attached an IAM role to it. Connected to instance using SSH key and accessed parameter value using the command:
    <$ aws ssm get-parameters --names "/wordpress/WORDPRESS_DB_NAME" "/wordpress/WORDPRESS_DB_USER" --region ap-southeast-2 --with-decryption>

@deniseddi
Copy link
Contributor

deniseddi commented Apr 21, 2020

How shoud I name this file?
parameter-store.tf ?

@kikobr82
Copy link
Contributor Author

That's your decision.. :) file names can change anytime anyway.. no need to worry with that.

Please, create a PR, so we can approve it and merge. Remember to include in the documentation what needs to be done once the terraform code is applied.

@deniseddi
Copy link
Contributor

"Remember to include in the documentation what needs to be done once the terraform code is applied." So, after running terraform apply ?

  • Create an EC2 instance to test accessing the parameter details?
  • Encrypt values for these keys manually through AWS console ? (Even though "SecureString" seems to do the job)
  • Use same "values" when configuring wordpress image ?

Kiko, I am not sure if you meant the above or something else?
And does this information to go into the documentation is to be saved in a file annexed to the parameter-store.tf as a README file or in here or elsewhere?
Cheers

@kikobr82
Copy link
Contributor Author

The EC2 creatio. is just so you can test and validate it's all working, so no need to be done on every deployment.

What you need to include in the README is the steps required to include the right values in those parameters store keys...
As you mentioning, if you are doing through the console, those values will be encrypted by default, so no need too have the encryption step included, but how to change the values in the console should be there..

@deniseddi
Copy link
Contributor

deniseddi commented Apr 22, 2020

For the README

After running terraform apply, in order to include the right values in the parameters store keys or change the values manually:

  • Log in to AWS console then go to Systems Manager service, which is located under Management & Governance.
  • Navigate to Parameter Store, under Application Management.
  • Select the parameter and click “Edit” to change/add the new value. Save changes.
    Remember to select “SecureString” to encrypt sensitive data using the KMS keys for your account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants