aws-amplify / aws-amplify/amplify-data

Amplify auth extension - IAM roles granted to schema

Open
#481 0 comments 0 reactions 0 assignees View on GitHub
feature-request GraphQL
Dominant language
TypeScript
Stars
18
Forks
23
Avg merge
26m
Merged PRs (30d)
1

Description

### Is this related to a new or existing framework?

Next.js

### Is this related to a new or existing API?

Authentication

### Is this related to another service?

_No response_

### Describe the feature you'd like to request

Hi! I am not sure if this feature is missing or just not found in docs, but I think it would be very useful if we could define different "authorized" objects - one for UserPool and one for IAM. The idea is to add to the default userpool (front end users) a possibility to define multiple rules for IAM roles (backend services not necessarily related to Amplify)

### Describe the solution you'd like

```
const schema = a
.schema({
Todo: a
.model({
content: a.string(),
})
.authorization((allow) => [
allow.authenticated(),
// plus IAM
allow.iamRoles([env.COPIER_SERVICE_IAM_ROLES]).to(["read"]),
allow.iamRoles([env.UPDATER_SERVICE_IAM_ROLES]).to(["read", "write"]),
]),
```

### Describe alternatives you've considered

Considered altering CF resources, but not sure where to change and what.

### Additional context

_No response_

### Is this something that you'd be interested in working on?

- [ ] 👋 I may be able to implement this feature request
- [ ] ⚠️ This feature might incur a breaking change

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named; begin by tracing the authentication schema authorization extension and the CloudFormation resources mentioned in the alternatives. Compare the existing UserPool and IAM authorization paths, and consider the requested role-specific read/write rules; done means the schema can express those separate IAM roles alongside authenticated access.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, typescript
Domain
api, authentication, authorization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.