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

ssm:AddTagsToResource is not included in the amplify admin policies #1094

Open
2 tasks done
OperationalFallacy opened this issue Jan 12, 2024 · 4 comments
Open
2 tasks done
Labels
bug An issue which has been identified as a bug iam-policy

Comments

@OperationalFallacy
Copy link

OperationalFallacy commented Jan 12, 2024

How did you install the Amplify CLI?

yarn

If applicable, what version of Node.js are you using?

v20.9.0

Amplify CLI Version

12.10.1

What operating system are you using?

Mac

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

Yes, custom category to expose api endpoint via ssm param, so cognito trigger functions can get access/config of API.

I believe this is the relevant piece in the template that causing deployment failure:

  "Resources": {
    "GraphQLEndpointParam": {
      "Type": "AWS::SSM::Parameter",
      "Properties": {
        "Name": {
          "Fn::Join": [
            "",
            [
              "amplify/GraphQLEndpoint-",
              {
                "Ref": "env"
              }
            ]
          ]
        },
        "Type": "String",
        "Value": {
          "Ref": "apixxxGraphQLAPIEndpointOutput"
        },
        "Description": "GraphQL API Endpoint for the current stage"
      }
    },

Describe the bug

Copied from the custom category template deployment

Resource handler returned message: "User: arn:aws:sts::xxx:assumed-role/us-east-1_aPwDmYAQx_Full-access/amplifyadmin is not authorized to perform: ssm:AddTagsToResource on resource: arn:aws:ssm:us-east-1:xxx:parameter/amplify/GraphQLEndpoint-prod because no identity-based policy allows the ssm:AddTagsToResource action (Service: Ssm, Status Code: 400, Request ID: b6c1b086-b903-42e4-ac3c-01da8c35a4d0)" (RequestToken: 9235f63d-1fc8-da09-7169-f926d777e87a, HandlerErrorCode: GeneralServiceException)

Expected behavior

amplify role should have permissions correctly configured

Reproduction steps

  1. Add a custom category that creates SSM parameter
  2. Try to deploy
🛑 Resource is not in the state stackUpdateComplete
Name: GraphQLEndpointParam (AWS::SSM::Parameter), Event Type: create, Reason: Resource handler returned message: "User: arn:aws:sts::xxx:assumed-role/us-east-1_aPwDmYAQx_Full-access/amplifyadmin is not authorized to perform: ssm:AddTagsToResource on resource: arn:aws:ssm:us-east-1:xxx:parameter/amplify/GraphQLEndpoint-prod because no identity-based policy allows the ssm:AddTagsToResource action (Service: Ssm, Status Code: 400, Request ID: b6c1b086-b903-42e4-ac3c-01da8c35a4d0)" (RequestToken: 9235f63d-1fc8-da09-7169-f926d777e87a, HandlerErrorCode: GeneralServiceException), IsCustomResource: false

Project Identifier

No response

Log output

# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.
@OperationalFallacy OperationalFallacy added the pending-triage An issue that is pending triage label Jan 12, 2024
@OperationalFallacy
Copy link
Author

The visual editor also complained that "lambda:GetLayerVersionbyArn" doesn't exit in Full-access-Policy

@ykethan
Copy link
Member

ykethan commented Jan 12, 2024

Hey @OperationalFallacy, thank you for reaching out. This look like a miss on AdministratorAccess-Amplify policy (AmplifySSMCalls) when the root stack tags are propagated to the nested stack, marking as bug.
But to mitigate the issue we should be able to add an inline policy allowing the SSM tags permission.
in regards to "lambda:GetLayerVersionbyArn" i have reached out to the appropriate team.

On a side note did notice the Name Join has amplify/GraphQLEndpoint- you will need to add /amplify/GraphQLEndpoint- as the qualified name expects a /

@ykethan ykethan added bug An issue which has been identified as a bug and removed pending-triage An issue that is pending triage labels Jan 12, 2024
@ykethan ykethan transferred this issue from aws-amplify/amplify-cli Jan 24, 2024
@bzsurbhi
Copy link

bzsurbhi commented Mar 6, 2024

Hey @OperationalFallacy, Amplify managed policy supports permissions for native categories like api, auth, storage. For custom use cases, customers will have to add permissions in their inline policy. Add ssm:AddTagsToResource permissions as a separate inline policy in this role us-east-1_aPwDmYAQx_Full-access

@OperationalFallacy
Copy link
Author

@bzsurbhi I'm confused, what is amplify managed policy? This is also a not custom case - this is amplify cli fails to make updates because some ssm permissions missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue which has been identified as a bug iam-policy
Projects
None yet
Development

No branches or pull requests

3 participants