aws-amplify / aws-amplify/amplify-cli
RFC: Add support for lambda resource policies and attributes for custom category
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
### Is this feature request related to a new or existing Amplify category?
custom
## Add support for lambda resource policies and attributes for custom category
Hi, would like to seek community's feedback on below proposal for Custom Category enhancement.
### Summary
Amplify Custom Category does not support lambda resources. Below proposes a new file that developers can define CRUD policy actions and attributes that can be used in functions when added as a dependency resource.
### Current


### Describe the solution you'd like
---
EDIT:
- 16 Mar - Updated resources.json to support multiple policies in create, update, read, delete.
---
1) Introduce a new file 'resources.json' in the category folder
e.g. AWS::SecretsManager::Secret
amplify -> backend -> custom -> Secrets -> resources.json
2) Resources will be loaded by Functions when trying to set custom resources
Example resources.json:
```json
{
"policies": {
"create": [],
"update": [],
"read": [
{
"Action": [
"secretsmanager:GetSecretValue"
],
"Resource": [
{
"Ref": "${categoryName}${resourceName}Arn"
}
]
}
],
"delete": []
},
"attributes": [
"Arn",
"Name"
]
}
```
Example Secrets Manager CF Template:
```yaml
AWSTemplateFormatVersion: "2010-09-09"
Parameters:
env:
Type: String
Conditions:
ShouldNotCreateEnvResources: !Equals [!Ref env, NONE]
Resources:
Secrets:
Type: AWS::SecretsManager::Secret
Properties:
Name: !Join ["", [!Ref "AWS::StackName", "-secrets-", !Ref env]]
Outputs:
Arn:
Description: Secrets ARN
Value: !Ref Secrets
Name:
Description: Secrets Name
Value: !Join ["", [!Ref "AWS::StackName", "-secrets-", !Ref env]]
```
Example Output CLI:

Example Output function-parameters.json:

Example Output Function CF Template:



### Describe alternatives you've considered
To be discussed.
### Additional context
Please refer to Pull Request #9090
### Is this something that you'd be interested in working on?
- [X] 👋 I may be able to implement this feature request
- [ ] ⚠️ This feature might incur a breaking change
Contributor guide
Research direction
Start by reviewing the custom category handling and the proposed resources.json, then compare the referenced PR #9090 with the function-parameters.json and CloudFormation examples in this issue. Done means the agreed design supports custom-category Lambda resource policies and attributes when functions use the resource as a dependency.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, json, typescript
- Domain
- cli, cloud
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100