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

feat: add support dynamoDB batch tasks using AWS SDK service integration #568

Merged

Conversation

tvhees
Copy link

@tvhees tvhees commented May 5, 2023

Creates the IAM Role for tasks which use the batch tasks targeting one or more dynamoDB tables. Supports BatchWriteItem and BatchGetItem

Currently a task defined this way will result in the following error.

Cannot generate IAM policy statement for Task state

With this change it correctly deploys and runs with permissions created for the minimal set of tables if possible.

RequestItems may specify the table names as keys, in which case permission resources will be applied only to the tables listed e.g.

WriteBatchToDynamo:
    Type: Task
    Resource: arn:aws:states:::aws-sdk:dynamodb:batchWriteItem
    Parameters:
      RequestItems:
        usersTable: $.userRequests
        postsTable: $.postRequests
      ReturnConsumedCapacity: TOTAL
    ResultPath: $.writeResult
    End: true

RequestItems can also be specified fully at runtime. In this case a '*' resource is necessary.

WriteBatchToDynamo:
    Type: Task
    Resource: arn:aws:states:::aws-sdk:dynamodb:batchWriteItem
    Parameters:
      RequestItems.$: $.requestItems
      ReturnConsumedCapacity: TOTAL
    ResultPath: $.writeResult
    End: true

@horike37 horike37 merged commit 28fa07b into serverless-operations:master Jul 10, 2023
@horike37
Copy link
Collaborator

🎉 This PR is included in version 3.14.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants