# Storing Secrets in Amazon Parameter Store to use in ECS

One way to pass secrets and variables securely to containers in AWS is to use Parameter Store. Navigate to the AWS Systems Manager service to get started.

## Parameter Store

### Create Parameter

1. Enter a name or path for the parameter.
2. Optionally add a description.
3. Select the tier to use.
4. Select the type. (we will choose SecureString.)
5. Select the KMS key source which is what will encrypt the SecureString.
6. Enter the value for the parameter.

## Creating a Role and policy for ECS in IAM

In order for the containers in our Task Definition to get parameters, we need to enable KMS decrypt and SSM get parameter permissions. Navigate to IAM to get started.

### Create Policy

Create a policy with permissions for KMS and SSM:

```
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "kms:Decrypt",
                "ssm:GetParameters"
            ],
            "Resource": [
                "arn:aws:kms:<aws-region>:<account-id>:key/<key-id>",
                "arn:aws:ssm:<aws-region>:<account-id>:parameter/<parameter>"
            ]
        }
    ]
}
```

### Create Role

1. Choose the service `Elastic Container Service`&#x20;
2. Select the use case as `Elastic Container Service Task`
3. Attach the policy created to read secrets from Parameter Store.
4. Enter a role name.
5. Enter a role description.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://devs.peerplays.com/tools-and-integrations/peerid/1.0.0/infrastructure/deployment-to-aws-ecs/storing-secrets-in-amazon-parameter-store-to-use-in-ecs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
