【问题标题】:Can you use AWS MGN (Application Migration) without an explicitly created access key and secret key?您可以在没有明确创建的访问密钥和秘密密钥的情况下使用 AWS MGN(应用程序迁移)吗?
【发布时间】:2022-02-08 11:13:56
【问题描述】:

我需要将本地环境迁移到 AWS。选择的工具是 AWS MGN(应用程序迁移)。我正在关注 AWS 关于在源应用程序上加载和使用代理的文档:

https://docs.aws.amazon.com/mgn/latest/ug/windows-agent.html

文档清楚地说明了对访问密钥和秘密密钥的需求。我们的环境设置有一个用户受限的根账户,团队通过 SSO 访问其他账户(例如 dev/test/prod/etc.)中的 AWS 环境。 MGN 服务还创建了四个角色:

  • AWSApplicationMigrationConversionServerRole
  • AWSApplicationMigrationMGHRole
  • AWSApplicationMigrationReplicationServerRole
  • AWSServiceRoleForApplicationMigrationService

我知道您可以使用“aws sts 承担角色”来收集所需的密钥,例如:

AWS_SESSION_TOKEN=$(echo "$test_assume_role_json" | jq -r '.Credentials.SessionToken')
export AWS_SESSION_TOKEN
AWS_ACCESS_KEY_ID=$(echo "$test_assume_role_json" | jq -r '.Credentials.AccessKeyId')
export AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY=$(echo "$test_assume_role_json" | jq -r '.Credentials.SecretAccessKey')

这些角色由 AWS 创建,我无法编辑它们以尝试授予我的 SSO 用户访问权限(我无法从 CLI 'aws sts 承担角色'),因此无法直接承担这些角色。我也无法创建使用 AWS 托管策略的角色。

我不确定我想做的事情是否可行,或者是否有一个我没有看到的简单解决方案。

编辑:我实际上成功地创建了一个测试角色,并在我想迁移到的帐户上使用以下策略:

  • AdministratorAccess(AWS 托管策略)
  • AWSApplicationMigrationAgentPolicy(AWS 托管策略)
  • AWSApplicationMigrationFullAccess(AWS 托管策略)
  • AWSApplicationMigrationMGHAccess(AWS 托管策略)
  • AWSApplicationMigrationReadOnlyAccess(AWS 托管策略)
  • AWSApplicationMigrationEC2Access(AWS 托管策略)
  • AWSApplicationMigrationConversionServerPolicy(AWS 托管策略)
  • AWSApplicationMigrationReplicationServerPolicy(AWS 托管策略)

然后我运行了假设角色来获取访问密钥和密钥:

C:\>aws sts assume-role --role-arn "arn:aws:iam::<REDACTED>:role/ApplicationMigrationTester" --role-session-name test --profile test
{
    "Credentials": {
        "AccessKeyId": "<REDACTED>",
        "SecretAccessKey": "<REDACTED>",
        "SessionToken": "<REDACTED>",
        "Expiration": "2021-07-15T22:55:08+00:00"
    },
    "AssumedRoleUser": {
        "AssumedRoleId": "<REDACTED>":test",
        "Arn": "arn:aws:sts::<REDACTED>:assumed-role/ApplicationMigrationTester/test"
    }
}

当出现提示时,我尝试使用这些值再次以管理员身份运行代理:

C:\>.\AwsReplicationWindowsInstaller.exe
The installation of the AWS Replication Agent has started.
AWS Region Name: us-east-1
AWS Access Key ID: <REDACTED>
AWS Secret Access Key:
Verifying that the source server has enough free disk space to install the AWS Replication Agent.
(a minimum of 2 GB of free disk space is required)
Identifying volumes for replication.
Choose the disks you want to replicate. Your disks are: c:
To replicate some of the disks, type the path of the disks, separated with a comma (for example, C:,D:). To replicate all disks, press Enter:
Disk to replicate identified: c:0 of size 620 GiB
All volumes for replication were successfully identified.
Downloading the AWS Replication Agent onto the source server...
Failed to validate AWS credentials
Installation failed.
Learn more about installation issues in our documentation at https://docs.aws.amazon.com/mgn/latest/ug/Troubleshooting-Agent-Issues.html#Error-Installation-Failed
Press Enter to close...

如您所见,它出错了。我向 AWS 提交了一张票,以查看我的方法目前是否可行。当他们回复时,我会更新。

【问题讨论】:

    标签: amazon-web-services migration amazon-iam assume-role


    【解决方案1】:

    您只应从命令行(powerShell 或 CMD)提供凭据

    C:\Downloads>.\AwsReplicationWindowsInstaller.exe --region us-east-1 --aws-access-key-id AKIA4HN2LIGPIERPMPXT --aws-secret-access-key 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-01-02
      • 1970-01-01
      • 1970-01-01
      • 2017-03-23
      • 2018-05-31
      • 2021-12-25
      • 2020-12-08
      • 1970-01-01
      相关资源
      最近更新 更多