-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
chore(rds): IO2
instance storage
#29395
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
IO2
instance storage
Exemption Request |
IO2
instance storageIO2
instance storage
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I made one minor comment.
test('create DB instance with io2 instance storage', () => { | ||
// WHEN | ||
new rds.DatabaseInstance(stack, 'Instance', { | ||
engine: rds.DatabaseInstanceEngine.MYSQL, | ||
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MEDIUM), | ||
vpc, | ||
storageType: rds.StorageType.IO2, | ||
}); | ||
|
||
// THEN | ||
Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { | ||
Iops: 1000, | ||
StorageType: 'io2', | ||
}); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already a similar test here, so it might be better to write it there.
Or maybe we could create tests that are separate from this test ('gp3 storage type'
) to check at once if the defaultIops
method outputs iops for each storage type. (Leave the test ('gp3 storage type'
) to check the storageThroughput
, and change the test name to another name related to gp3
and storageThroughput
.)
For example:
test.each([
[rds.StorageType.STANDARD, 'standard', 2000, undefined],
[rds.StorageType.GP2, 'gp2', 2000, undefined],
[rds.StorageType.GP3, 'gp3', 2000, 2000],
[rds.StorageType.IO1, 'io1', 2000, 2000],
[rds.StorageType.IO1, 'io1', undefined, 1000],
[rds.StorageType.IO2, 'io2', 2000, 2000],
[rds.StorageType.IO2, 'io2', undefined, 1000],
])('storage type and IOPS for %s storage type', (inStorageType, outStorageType, inIops, outIops) => {
new rds.DatabaseInstance(stack, 'Instance', {
engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_30 }),
vpc,
storageType: inStorageType,
iops: inIops,
});
Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', {
StorageType: outStorageType,
Iops: outIops ?? Match.absent(),
});
});
It may not be to your taste, which do you think would be better? Of course, the above code can be modified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@go-to-k Thank you for the excellent suggestion!! I replaced unit test and renamed existing gp3
test.
By the way, what happens if we specify a value lower than 1000? |
Upon checking the behavior, it appears to fail during deployment. integRdsInstanceIo2 | 9:52:23 PM | CREATE_FAILED | AWS::RDS::DBInstance | Instance (InstanceC1063A87) Resource handler returned message: "Invalid iops value for engine name mysql and storage type io2: 500 (Service: Rds, Status Code: 400, Request ID: 2f806c31-840b-4774-86cf-26c3308a7631)" (RequestToken: d5833b29-5411-1712-8804-320a30504df9, HandlerErrorCode: InvalidRequest) I think CDK should validate if the I'll create another issue about that and resolve it. |
@badmintoncryer Yes! I think so. I will approve this PR! |
@go-to-k Thank you Hero!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR and to @go-to-k for a great review! I do agree we need validation for the different storage types, approving this for now
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
1 similar comment
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Issue # (if applicable)
Closes #29396.
Reason for this change
AWS RDS now supports IO2 instance storage but CDK cannot configure it yet.
Description of changes
StorageType
enum.Description of how you validated changes
Added both unit and integ test
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license