Skip to content

agentcore deploy --target not use my target settings #1150

@uniquejava

Description

@uniquejava

Description

I am playing with 2nd target 987654321012, but from the CDK error message it shows something related to 123456789012, clearly it reads some settings in target1, not target2.

  1. create new project with agentcore cli
  2. set 2 targets in agentcore/aws-targets.json
[
  {
    "name": "target1",
    "description": "Development environment",
    "account": "123456789012",
    "region": "eu-west-1"
  },
 
  {
    "name": "target2",
    "description": "Personal AWS accoun",
    "account": "987654321012",
    "region": "ap-northeast-1"
  }
]
  1. try to deploy

$ agentcore deploy --target target2 --yes
✓ Load deployment target
✓ Validate project
✓ Build CDK project
✓ Creating credentials...
✓ Synthesize CloudFormation
✓ Check bootstrap status
✓ Check stack status

CDK deploy failed: Could not assume role in target account using current credentials (which are for account 987654321012) User: arn:aws:iam::987654321012:user/xiaohao is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::123456789012:role/cdk-xxxxxxxx-deploy-role-123456789012-eu-west-1 . Please make sure that this role exists in the account. If it doesn't exist, (re)-bootstrap the environment with the right '--trust', using the latest version of the CDK CLI.

Steps to Reproduce

see above

Expected Behavior

123456789012 should not appear in the error message

Actual Behavior

CDK deploy failed: Could not assume role in target account using current credentials (which are for account 987654321012) User: arn:aws:iam::987654321012:user/xiaohao is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::123456789012:role/cdk-xxxxxxxx-deploy-role-123456789012-eu-west-1

CLI Version

0.13.0

Operating System

macOS

Additional Context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions