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.
-
Open the IAM console
- In the search bar, type IAM, then select IAM.
- In the left menu, select Roles.
- Select Create role.

-
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.

-
On the Add permissions page
- In the search box under Permissions policies, type
AWSElasticDisasterRecoveryAgentInstallationPolicy.
- Tick the checkbox for AWSElasticDisasterRecoveryAgentInstallationPolicy.
- Select Next.

-
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.

-
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
Use this only when you cannot assume a role (for example, because the account has restricted permissions). This method creates a long-lived access key, which is less secure than temporary credentials and must be deleted in section 9.
-
On the Identity and Access Management (IAM) console
- In the left menu of the IAM console, select IAM Users.
- Select Create user.

-
On the Specify user details page
- For User name, enter
drs-agent-user.
- Do not select Provide user access to the AWS Management Console.
- Select Next.

-
On the Set permissions page
- Select Attach policies directly.
- In the search box of the Permissions policies list, type
AWSElasticDisasterRecoveryAgentInstallationPolicy.
- Tick the checkbox for AWSElasticDisasterRecoveryAgentInstallationPolicy.
- Select Next.

-
On the Review and create page
- Check that the policy appears in the list.
- Select Create user. A green banner reports that the user was created, and
drs-agent-user appears in the list.

-
On the details page of drs-agent-user
- Select the user name
drs-agent-user.
- Select the Security credentials tab.
- Under Access keys, select Create access key.

-
On the Access key best practices & alternatives page
- Under use case, select Other.
- Select Next.

-
On the Set description tag - optional page, select Create access key.

-
On the Retrieve access keys page
- The page displays Access key and Secret access key.
- Select Download .csv file. A
.csv file containing both values is saved to your computer.
- Select Done. The user’s Access keys section has one key with the status Active.

In section 6, use these two values and omit the --aws-session-token flag.