AWS Secrets Manager

AWS Secrets Manager is Amazon's cloud service for securely storing and managing secrets, API keys, and other sensitive data. The EnvManager AWS Secrets Manager integration allows you to automatically sync your environment variables from EnvManager directly to secrets in AWS Secrets Manager.

When you connect AWS Secrets Manager to EnvManager, each variable is stored as an individual secret in your chosen AWS region. No more manually creating secrets or copying values between tools.

What You Can Do

With the AWS Secrets Manager integration, you can:

  • Connect your AWS account with an IAM access key and secret
  • Sync variables as secrets — each variable becomes its own secret in Secrets Manager
  • Use a name prefix to namespace your secrets per environment (e.g., PROD so DATABASE_URL becomes PROD_DATABASE_URL)
  • Choose which environments to sync — control exactly which EnvManager environments push to AWS
  • Automatic syncing — secrets update in AWS whenever you change variables in EnvManager
  • Manual sync control — trigger syncs on demand when you need them
  • Track sync history — see when secrets were synced and if any errors occurred

Before You Begin

To connect AWS Secrets Manager, you need:

  • An EnvManager account with a project created
  • An AWS account
  • Admin or Owner role in your EnvManager organization (required to manage integrations)
  • An IAM user with programmatic access (access key ID and secret access key)
  • IAM permissions for Secrets Manager (CreateSecret, PutSecretValue, DeleteSecret)

The sections below walk you through creating an IAM user, attaching the correct permissions, and connecting to EnvManager.

How to Create an IAM User

If you already have an IAM user with the required permissions, you can skip to Connecting Your AWS Secrets Manager.

Open the AWS Console

Go to console.aws.amazon.com and sign in with your AWS account.

In the search bar at the top, type IAM and select IAM from the results.

Create a New User

In the left menu, click Users, then click Create user at the top of the page.

Fill In User Details

  • User name: envmanager-sync (or any name you prefer)
  • Click Next

Set Permissions

  1. Select Attach policies directly
  2. Click Create policy to open the policy editor in a new tab
  3. Select the JSON tab and paste the minimal policy below
  4. Click Next, give the policy a name (e.g., EnvManagerSecretsAccess), and click Create policy
  5. Return to the user creation tab, click the refresh button, and search for the policy you just created
  6. Select it and click Next, then Create user

Create an Access Key

  1. Click on the user you just created
  2. Go to the Security credentials tab
  3. Under Access keys, click Create access key
  4. Select Third-party service as the use case
  5. Click Create access key

Copy both the Access key ID and the Secret access key immediately — the secret is only shown once.

Security Note: The secret access key grants access to your AWS Secrets Manager. Do not commit it to version control or share it publicly. EnvManager stores the credentials encrypted. Consider rotating access keys periodically for security.

Minimal IAM Policy

Use this policy to grant only the permissions EnvManager needs:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "secretsmanager:GetSecretValue",
        "secretsmanager:CreateSecret",
        "secretsmanager:PutSecretValue",
        "secretsmanager:TagResource",
        "secretsmanager:DeleteSecret",
        "secretsmanager:RestoreSecret"
      ],
      "Resource": "arn:aws:secretsmanager:REGION:ACCOUNT_ID:secret:PROD_*"
    },
    {
      "Effect": "Allow",
      "Action": "secretsmanager:ListSecrets",
      "Resource": "*"
    }
  ]
}

Replace REGION, ACCOUNT_ID, and PROD_ with your region, account ID, and the prefix you will use in EnvManager (followed by an underscore). One prefix per environment means one Resource line per environment — list them all in the same statement.

Why each permission: GetSecretValue lets EnvManager compare before writing, so an unchanged sync creates no new versions. TagResource marks secrets as EnvManager-managed. RestoreSecret brings back a secret that was removed and then re-added within its recovery window. ListSecrets (which AWS only accepts on Resource: "*") is used once during Validate to confirm the key can reach Secrets Manager in your region. If a permission is missing, validation or sync tells you exactly which one.

Resource scoping: The Resource ARN limits the key to secrets whose names start with your prefix. If you leave the prefix empty in EnvManager, use arn:aws:secretsmanager:REGION:ACCOUNT_ID:secret:* instead (less isolated).

Connecting Your AWS Secrets Manager

From your EnvManager dashboard, go to Settings and click the Integrations tab.

Open the AWS Connect Modal

Find the AWS Secrets Manager card and click the Connect button.

Enter Connection Details

Fill in the form:

  1. Connection Name — Give this connection a friendly name (e.g., "Production AWS")
  2. Access Key ID — The IAM access key ID (starts with AKIA...)
  3. Secret Access Key — The secret access key you copied when creating the access key
  4. Region — Select the AWS region where your secrets should be stored (e.g., US East - N. Virginia)

Validate Credentials

Click Validate Credentials to test the connection. EnvManager will verify that your access key ID and secret access key are valid by calling the AWS STS API.

You'll see a success indicator with your AWS account ID confirmed once validation passes.

Complete the Connection

Click Connect to save the connection. Your AWS Secrets Manager is now linked to this EnvManager organization.

Configuring Your Sync

After connecting AWS Secrets Manager, you need to configure which environments sync and how secrets are named.

Open Configuration

On the AWS Secrets Manager integration card, click Configure to open the sync configuration modal.

Enable Environments for Sync

You'll see a list of your EnvManager environments. Toggle on each environment you want to sync to AWS Secrets Manager.

You can enable all environments or just specific ones — for example, only syncing your Production environment.

Set an Optional Secret Name Prefix

A prefix is added to the beginning of every secret name in AWS. This is useful to:

  • Namespace your secrets per environment (e.g., PROD so secrets appear as PROD_DATABASE_URL)
  • Avoid naming conflicts with existing secrets
  • Keep two environments that sync to the same AWS account and region from overwriting each other

The prefix is prefilled with the environment name and accepts letters and numbers only; EnvManager joins it to each key with an underscore. Clear the field if you don't need a prefix — but if two environments on one connection end up with the same prefix, EnvManager shows a warning, because their secrets would collide.

Configure Sync Options

Choose what and when to sync:

OptionDescriptionRecommended
Auto-syncAutomatically sync when variables change in EnvManagerEnabled for most use cases
Sync secretsInclude secret variablesEnabled
Sync regular variablesInclude non-secret variablesEnabled

EnvManager keeps AWS equal to what you chose to sync. If you turn Sync secrets (or Sync regular variables) off after a sync, the next sync schedules those previously synced secrets for deletion in AWS. They stay recoverable for 7 days (see Secret versions and deletion below); turn the option back on and sync again within that window to restore them.

Save Configuration

Review your settings and click Save Configuration. Your sync is now active.

Syncing Variables

Automatic Syncing

If you enabled auto-sync, EnvManager will automatically push variables to AWS Secrets Manager whenever:

  • You add a new variable (creates a new secret)
  • You edit an existing variable's value (updates the secret)
  • You delete a variable (the secret is deleted from AWS)

Changes typically appear in AWS within seconds.

Manual Syncing

You can trigger a sync manually at any time:

Click Sync Now

On the AWS Secrets Manager integration card, click the Sync Now button.

Watch the Progress

A progress indicator shows the sync status. The sync will:

  1. Gather variables from enabled EnvManager environments
  2. Create or update each variable as a secret in AWS Secrets Manager
  3. Report success or errors per environment

Verify in AWS Console

Open the AWS Secrets Manager console and verify that your secrets appeared correctly.

Manual sync is useful when setting up the integration for the first time or when you want to immediately verify a change reached AWS.

Secret Naming in AWS

Each EnvManager variable becomes one secret in AWS Secrets Manager. Variable names pass through unchanged — DATABASE_URL stays DATABASE_URL. If you set a prefix, it is joined to the name with an underscore:

EnvManager VariablePrefixAWS Secret Name
DATABASE_URL(none)DATABASE_URL
DATABASE_URLPRODPROD_DATABASE_URL
NEXT_PUBLIC_APISTAGINGSTAGING_NEXT_PUBLIC_API

Secret versions and deletion: AWS Secrets Manager stores every value write as a version. EnvManager keeps this tidy for you:

  • A sync only writes a new version when the value actually changed. Syncing unchanged variables creates nothing.
  • When you delete a variable in EnvManager, or a sync no longer includes it, its AWS secret is scheduled for deletion with a 7-day recovery window — never destroyed immediately. It disappears from normal reads at once, but you can restore it from the AWS console within 7 days, and EnvManager restores it automatically if you re-add the same key in that window.

Tags: Secrets created by EnvManager carry the tags managed-by = envmanager and envmanager-env = <environment name>. Filter on them in the AWS console, or run aws secretsmanager list-secrets --filters Key=tag-key,Values=managed-by to see exactly which secrets EnvManager owns.

Managing Your Connection

Updating Configuration

To change which environments sync or update the prefix:

  1. Click Configure on the AWS Secrets Manager integration card
  2. Make your changes
  3. Click Save Configuration

The new configuration takes effect immediately for the next sync.

Disconnecting AWS Secrets Manager

To remove the AWS Secrets Manager integration:

  1. Click the Disconnect button on the integration card
  2. Confirm the disconnection in the dialog that appears

Important: Disconnecting does NOT remove secrets from AWS Secrets Manager. Your secrets remain in AWS, but future changes in EnvManager won't sync. You can manually delete secrets from the AWS console if needed.

Reconnecting

If you disconnect and want to reconnect later:

  • Click Connect again and go through the connection process
  • You can use the same IAM credentials or create new access keys
  • You'll need to reconfigure your environment toggles and prefix

Tips & Best Practices

Start with Manual Sync

When setting up the integration for the first time:

  1. Configure with auto-sync disabled
  2. Trigger a manual sync to verify secrets appear in AWS Secrets Manager
  3. Confirm the secret names and values look correct in the AWS console
  4. Enable auto-sync once you're confident everything is working

Use a Prefix to Namespace Your Secrets

If your AWS account already has secrets, or several EnvManager environments sync into the same account and region, keep a distinct prefix per environment (the default is the environment name). Together with the managed-by = envmanager tag this makes it obvious which secrets belong to which environment.

Rotate Access Keys Periodically

AWS recommends rotating access keys regularly. To rotate:

  1. Create a new access key for the IAM user in the AWS console
  2. Update the connection in EnvManager by disconnecting and reconnecting with the new key
  3. Delete the old access key from the IAM user
  4. Verify syncing works with the new credentials

Limit IAM Permissions

The minimal IAM policy above grants only the permissions EnvManager needs — CreateSecret, PutSecretValue, and DeleteSecret. Avoid granting broader permissions like secretsmanager:* or attaching the SecretsManagerReadWrite managed policy, which provides more access than needed.

Troubleshooting

"Access Key ID not recognized" or "Secret Access Key is wrong" during validation

Cause: The access key ID does not exist (or the IAM user was deleted), or the secret access key was copied incorrectly.

Solution:

  1. Verify the access key ID starts with AKIA (for long-term credentials)
  2. Make sure you copied the full secret access key when it was created
  3. Check that the IAM user and the access key have not been deactivated or deleted
  4. If the access key was rotated, use the new credentials
  5. Re-enter the credentials in EnvManager and try validation again

"Permission denied: the IAM policy is missing secretsmanager:…"

Cause: The key is valid, but the IAM policy does not grant everything EnvManager needs. Validation reports a missing ListSecrets; a sync reports whichever action failed (for example GetSecretValue on a policy written for an older version of this guide).

Solution:

  1. Open the IAM console and find the user
  2. Attach the policy from Minimal IAM Policy above — all seven actions
  3. Verify the policy Resource ARN matches your prefix — if the prefix is PROD, the ARN must cover arn:aws:secretsmanager:REGION:ACCOUNT_ID:secret:PROD_*
  4. Check if any Service Control Policies (SCPs) in your AWS Organization are blocking access

A secret I removed and re-added shows "marked for deletion"

Cause: AWS reserves the name of a secret for its recovery window. EnvManager restores it automatically, which needs secretsmanager:RestoreSecret.

Solution: Add RestoreSecret to the policy and sync again — or wait for the recovery window to end, after which the secret is created fresh.

"Invalid region" error

Cause: The selected region is not available or the Secrets Manager service is not enabled in that region.

Solution:

  1. Make sure you selected a valid AWS region from the dropdown
  2. Verify Secrets Manager is available in your chosen region (it's available in all standard regions)
  3. Try selecting a different region

Variables not appearing in AWS Secrets Manager

Cause: The sync may have failed, or the environment is not enabled for sync.

Solution:

  1. Click Configure and verify that the relevant environments are toggled on
  2. Check the sync history for error messages on the integration card
  3. Trigger a manual sync and watch for errors
  4. Make sure you're looking in the correct AWS region in the console

Auto-sync not triggering

Cause: Auto-sync may be disabled in the configuration, or the sync is failing silently.

Solution:

  1. Click Configure and verify Auto-sync is enabled
  2. Check the sync history for recent failed syncs
  3. Try a manual sync to confirm the connection is still working
  4. If access keys were rotated, reconnect with the new credentials

Variables Overview

Learn how to create and manage variables in EnvManager.

Environments

Understand environments and how they organize your variables.

Access Control

Manage who can configure integrations and sync variables.

Get DevOps tips in your inbox

Security best practices and product updates. No spam.

No spam. Unsubscribe anytime.