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

Create PAY_PER_REQUEST dynamodb table #609

Closed
mdavis-xyz opened this issue Jun 25, 2021 · 8 comments · Fixed by #753
Closed

Create PAY_PER_REQUEST dynamodb table #609

mdavis-xyz opened this issue Jun 25, 2021 · 8 comments · Fixed by #753
Labels
feature This issue/PR relates to a feature request module module plugins plugin (any type)

Comments

@mdavis-xyz
Copy link
Contributor

mdavis-xyz commented Jun 25, 2021

SUMMARY

Dynamodb tables can either have a fixed capacity, or be serverless (autoscaling).
The dynamodb_table Ansible module can only create a fixed capacity table. I want to use it to create an autoscaling table.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

dynamodb_table

ADDITIONAL INFORMATION

Interface:

The read_capacity and write_capacity fields default to 1.

I feel like semantically it would be nice to default to PAY_PER_REQUEST if both read and write capacity were omitted. Although that might be considered a backwards incompatible change.

Alternatively, what if the capacity fields accept a string like "PAY_PER_REQUEST"? Or we add an additional field?

billing_mode: PAY_PER_REQUEST | PROVISIONED

or:

serverless: True

Implementation:

I looked at the code. It doesn't make sense to me. Table.create() is not a documented method.

@ansibullbot
Copy link

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request module module needs_triage plugins plugin (any type) labels Jun 25, 2021
@nick-zh
Copy link

nick-zh commented Sep 23, 2021

I would be very interested in this addition as well. I am totally new (with ansible in general), but i would be willing to give it a shot to try to contribute.
@tremble i assume though, it would be best to hold of until #726 has been merged?
I think it would make sense to add billing mode as a seperate field, any thoughts?

@ansibullbot
Copy link

@tremble
Copy link
Contributor

tremble commented Sep 23, 2021

@nick-zh yeah I'd recommend waiting until #726 has been merged. I believe the only issue is a CI permissions issue.

While it might be "nice" to add the extra fields while we're working on the module. The scope creep generally makes it harder to properly review each part of the change.

@nick-zh
Copy link

nick-zh commented Sep 23, 2021

@tremble many thanks for the feedback. I'll watch the other PR then. Since i would be a first time contributer and new to the topic, do you think, i would be able to tackle this?

@tremble
Copy link
Contributor

tremble commented Sep 23, 2021

Some of the dynamodb code isn't exactly the most "beginner friendly" (avoid looking too deep into the index/attributes pieces).

However, hopefully with the way it's written in 726 adding support to manage "BillingMode" would be a relatively simple change.

@marknet15
Copy link
Contributor

marknet15 commented Sep 24, 2021

Hey 👋🏻 So I do actually have a branch lined up now with the billing_mode option added, currently based off of the open PR for boto3, as soon as the boto3 PR is merged I can rebase and create a PR and do some testing.
https://github.com/marknet15/community.aws/tree/billing_mode_support

@tremble tremble linked a pull request Oct 11, 2021 that will close this issue
ansible-zuul bot added a commit that referenced this issue Oct 15, 2021
DynamoDB billing mode support

SUMMARY
Current the dynamodb_table module only supports provisioned table creations, this adds support for defining a billing_mode to create either pay_per_request or provisioned tables.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html#DynamoDB.Client.create_table
This change does also allow for changing the billing_mode on existing tables.
fixes: #609
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
dynamodb_table
ADDITIONAL INFORMATION
Example of creating a DynamoDB table with pay_per_request:
- name: Create a pay-per-request table
  community.aws.dynamodb_table:
    name: my-table
    region: eu-west-1
    hash_key_name: id
    hash_key_type: STRING
    billing_mode: PAY_PER_REQUEST

Reviewed-by: Mark Woolley <mw@marknet15.com>
Reviewed-by: Mark Chappell <None>
Reviewed-by: None <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request module module plugins plugin (any type)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants