Create credentials for the DRS agent

Create credentials for the DRS agent

  • Real on-premises servers do not have an EC2 instance profile, so the AWS Replication Agent installer needs AWS credentials with the AWSElasticDisasterRecoveryAgentInstallationPolicy policy.
  • We create the IAM role drs-agent-installation-role with that policy and obtain temporary credentials from AWS STS, as recommended in the DRS documentation. These credentials are used only in section 6 to install the agent on the two source servers.
  • If your account does not allow role assumption, use the IAM user fallback at the end of this page.
Sign in to the console with an IAM user or role that has administrator permissions, not the root user. The root user cannot call AssumeRole (error Roles may not be assumed by root accounts), so item 5 will fail.
  1. Open the IAM console

    • In the search bar, type IAM, then select IAM.
    • In the left menu, select Roles.
    • Select Create role.

    AWS Elastic Disaster Recovery Workshop

  2. On the Select trusted entity page

    • For Trusted entity type, select AWS account.
    • In the An AWS account box, keep This account, which is already selected.
    • Select Next.

    AWS Elastic Disaster Recovery Workshop

  3. On the Add permissions page

    • In the search box under Permissions policies, type AWSElasticDisasterRecoveryAgentInstallationPolicy.
    • Tick the checkbox for AWSElasticDisasterRecoveryAgentInstallationPolicy.
    • Select Next.

    AWS Elastic Disaster Recovery Workshop

  4. On the Name, review, and create page

    • For Role name, enter drs-agent-installation-role.
    • Scroll down and select Create role. A green banner reports that the role drs-agent-installation-role was created.

    AWS Elastic Disaster Recovery Workshop

  5. In the CloudShell window

    • If the Region selector at the top right does not show Oregon, select US West (Oregon) us-west-2. CloudShell uses this Region.
    • Select the CloudShell icon (>_) on the top bar of the console. A terminal opens at the bottom of the console with a cloudshell-user prompt. The first startup takes about 1 minute.
    • Paste the following command into CloudShell and press Enter:
    ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
    aws sts assume-role \
      --role-arn arn:aws:iam::${ACCOUNT_ID}:role/drs-agent-installation-role \
      --role-session-name drs-agent-install \
      --duration-seconds 3600 \
      --query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken,Expiration]' \
      --output text
    
    • The command prints one line with four tab-separated values, for example (shortened):
    ASIAXXXXXXXXEXAMPLE    wJalrXXXXXXXXXXXXEXAMPLEKEY    IQoJb3JpZ2luX2VjEXAMPLE...    2026-01-01T11:00:00+00:00
    
    • AccessKeyId, starting with ASIA (used for <ACCESS_KEY_ID> in section 6)
    • SecretAccessKey (used for <SECRET_ACCESS_KEY>)
    • SessionToken, a very long string (used for <SESSION_TOKEN>)
    • Expiration, when the credentials expire (1 hour from now)
    • If the command returns AccessDenied immediately after the role is created, wait 30 seconds and run it again (IAM changes can take a few seconds to take effect).
    • Leave the CloudShell panel open and do not run clear. In section 6, copy the values from this line into the installation command.
STS credentials expire after 1 hour. If they expire before you finish section 6, run the command from item 5 again (when you are signed in with a role, role chaining also limits the maximum duration to 1 hour).
Fallback: IAM user with an access key