How to Use AWS Systems Manager Store to Secure String Parameters?

Benefits Of Using AWS Systems Manager Parameter Store
July 12, 2021

When there are deployments across environments, it is unsafe from a security standpoint to store critical information like DB passwords, connection strings, etc., in version control with limited access. Some use vaults to store the values, which is difficult to maintain, and in worst scenarios, they hardcode the values in their code stored in their versioning system. This is not good practice as it might broaden your security gaps.

AWS Systems Manager Parameter Store provides secure, hierarchical storage for configuration data and secrets management. You can store your configuration values, such as passwords, database credentials, etc., at no extra cost.

You can store 3 different types of data:

  •    String
  •    String List
  •    Secure String

Let’s focus on Secure String in this blog, as this is stored as encrypted values with the help of KMS, and see how we can store and retrieve the keys. Parameter Store supports hierarchies. What it means is that the keys are stored in a more structured way. Let’s understand it with the help of an example:

Suppose you want to store the key named ‘abc’ for the application named ‘TestApp’ and the Production environment.

We will be storing it as: /Prod/TestApp/abc

Adding Keys:

You can add the keys via AWS console or create them programmatically using API/SDK/CLI.

Adding keys through AWS SSM Console

To add keys through AWS SSM Console:

  1. Sign in to your AWS Console and select an appropriate region.
  2. Under Services, click on Systems Manager.
  3. On the left side pane, scroll down and click on the Parameter Store.
  4. Click on Create Parameter.
  5. Enter the Name of the keys you want to store. Example /Prod/TestApp/abc
  6. Enter the Description(Optional)
  7. Select Secure String. Under KMS key source, select My current account if you want to use the KMS key present in your account.
  8. From the drop-down list, select the KMS Key ID you want to use to encrypt the values.
  9. Enter the Value which you need to store and click on the Create Parameter.

Accessing Values:

To access these values in your application, you can use AWS API/SDK/CLI or view it on the Console. As an example, how you can retrieve it using AWS CLI command.

aws --region=us-east-1 ssm get-parameters --names \"/Prod/TestApp/abc \" --with-decryption

This will return the decrypted value. The user or role running this command should have access to use the KMS key to execute this command successfully.

More information can be found at :

https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-paramstore.htm

To get the latest insights, research and expert articles on AWS Services, Cloud Migration, DevOps and other technologies, subscribe to our Blog Newsletter here. For AWS Case studies and success stories, visit Case Study Section

Written by – Atin Mittal

Cloud Computing Insights and Resources

Cloud Consulting

6 Reasons to Collaborate with a Cloud Consulting Firm in 2024

The technology landscape keeps evolving, without a break, and the shift towards cloud solutions is undeniable. Companies are increasingly embracing […]

cloud computing

10 Secrets of Optimum Utilization of Clouds 

Cloud computing has emerged as a significant trend in recent years, transforming how businesses operate and delivering a range of […]

AWS migration

An Introduction to AWS’ Migration Acceleration Program

What is AWS MAP?  The Migration Acceleration Program (MAP) stands as an exclusive offering from Amazon Web Services (AWS), available […]