zealvora / terraform-beginner-to-advanced-resource

1.93k stars 5.34k forks source link

Key pair creation steps #5

Open boopathigithub opened 3 years ago

boopathigithub commented 3 years ago

Hi,

It would be helpful if the instruction is given to create a key-value pair and how to update the key-value pair in AWS?

UtkR08 commented 4 months ago

Sure! Here's how to create and update key-value pairs in AWS using AWS Systems Manager Parameter Store.

Creating a Key-Value Pair

  1. Sign in to the AWS Management Console and open the Systems Manager console at AWS Systems Manager Console.

  2. In the navigation pane, choose Parameter Store.

  3. Choose Create parameter.

  4. Specify the following values:

    • Name: Enter a name for the parameter. The name can include a path and hierarchical names, for example, /MyApp/Dev/DBPassword.
    • Description: Optionally, enter a description for the parameter.
    • Tier: Choose Standard or Advanced. Advanced parameters have additional features and a higher limit on parameter size.
    • Type: Choose the type of parameter. For a key-value pair, typically you will choose String.
    • Data type: Choose text (if available) or leave as text.
    • Value: Enter the value of the parameter.
    • Key ID: (Optional) If you want to encrypt the parameter value, choose the KMS key to use for encryption.
    • Tags: (Optional) Add key-value tags to help you identify the parameter.
  5. Choose Create parameter to save your new key-value pair.

Updating a Key-Value Pair

  1. Sign in to the AWS Management Console and open the Systems Manager console at AWS Systems Manager Console.

  2. In the navigation pane, choose Parameter Store.

  3. Choose the parameter you want to update from the list.

  4. Choose Edit.

  5. Modify the values for the parameter as needed:

    • Update the Description.
    • Change the Type if needed (note: this may have restrictions).
    • Update the Value of the parameter.
    • Update the Key ID if changing encryption settings.
    • Update Tags if necessary.
  6. Choose Save changes to apply your updates.

Example Using AWS CLI

Creating a Parameter

aws ssm put-parameter \
    --name "/MyApp/Dev/DBPassword" \
    --description "Database password for MyApp in Dev environment" \
    --value "MySecretPassword" \
    --type "String"

Updating a Parameter

aws ssm put-parameter \
    --name "/MyApp/Dev/DBPassword" \
    --value "MyNewSecretPassword" \
    --type "String" \
    --overwrite

These steps and commands will help you manage key-value pairs in AWS Systems Manager Parameter Store efficiently.