Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(aws-cli): import ressources failed (fail to publish assets) #26922

Closed
BDeus opened this issue Aug 29, 2023 · 2 comments
Closed

(aws-cli): import ressources failed (fail to publish assets) #26922

BDeus opened this issue Aug 29, 2023 · 2 comments
Labels
@aws-cdk/assets Related to the @aws-cdk/assets package bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@BDeus
Copy link
Contributor

BDeus commented Aug 29, 2023

Describe the bug

When i try to import supported ressources through cdk import command, the command failed with a fail: Access Denied.
It seems that the import command use the DeploymentActionRole to push assets on staging bucket.

Here the output logs:

[12:05:33] Reading existing template for stack XXXXXXX.
[12:05:33] Retrieved account ID 00000000 from disk cache
[12:05:33] Assuming role 'arn:aws:iam::00000000:role/cdk-lookup-role'.
[12:05:39] Retrieving template summary for stack XXXXXXX.
[12:05:39] Retrieved account ID 00000000 from disk cache
[12:05:39] Assuming role 'arn:aws:iam::00000000:role/cdk-deploy-role'.
[12:05:39] Waiting for stack cdk-bootstrap to finish creating or updating...
[12:05:39] Storing template in S3 at: https://cdk-assets-00000000-region.s3.region.amazonaws.com/cdk/XXXXXXX/2accfd15fcf2c18a2beecf6b63897529f60e2a0398b4148cc94b4e93c86e7b81.yml
[12:05:39] [0%] start: Publishing 2accfd15fcf2c18a2beecf6b63897529f60e2a0398b4148cc94b4e93c86e7b81:current
[12:05:40] [0%] check: Check s3://cdk-assets-00000000/cdk/XXXXXXX/2accfd15fcf2c18a2beecf6b63897529f60e2a0398b4148cc94b4e93c86e7b81.yml
[12:05:40] [0%] upload: Upload s3://cdk-assets-00000000/cdk/XXXXXXX/2accfd15fcf2c18a2beecf6b63897529f60e2a0398b4148cc94b4e93c86e7b81.yml
[100%] fail: Access Denied
Failed to publish one or more assets. See the error messages above for more information.

Expected Behavior

Use FilePublishingRole to push assets like the deploy command

Current Behavior

The DeploymentActionRole used from bootstrap do not have the permission to PutObject on the assets Bucket.

- Sid: CliStagingBucket
Effect: Allow
Action:
- s3:GetObject*
- s3:GetBucket*
- s3:List*
Resource:
- Fn::Sub: ${StagingBucket.Arn}
- Fn::Sub: ${StagingBucket.Arn}/*

Reproduction Steps

Create an importable ressource manually (i tried with an ECR Repository) and try to import it to an existing CDK stacks

Possible Solution

Use the FilePublishingRole to push assets

Additional Information/Context

Bootstrap used: 12

CDK CLI Version

2.93.0

Framework Version

No response

Node.js Version

18

OS

windows 10

Language

Java

Language Version

No response

Other information

No response

@BDeus BDeus added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 29, 2023
@github-actions github-actions bot added the @aws-cdk/assets Related to the @aws-cdk/assets package label Aug 29, 2023
@peterwoodworth
Copy link
Contributor

peterwoodworth commented Aug 29, 2023

Could you provide some more details about your setup? I don't think I understand exactly what you're doing. All you're trying to do is import an ECR repo correct? I'm not sure how bucket permissions are coming into play if that's the case. Additionally, did you make sure that your cdk diff is showing nothing aside from the resource you want to import? Reproduction code and explicit steps would be helpful here 🙂

@peterwoodworth peterwoodworth added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Aug 29, 2023
@github-actions
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Aug 31, 2023
@github-actions github-actions bot added closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Sep 5, 2023
@github-actions github-actions bot closed this as completed Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/assets Related to the @aws-cdk/assets package bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants