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

fix(stepfunctions-tasks): state machine role is missing sagemaker:AddTags permission for SageMakerCreateTransformJob task #27264

Conversation

tam0ri
Copy link
Contributor

@tam0ri tam0ri commented Sep 24, 2023

If we specified RUN_JOB as IntegrationPattern prop for SageMakerCreateTransformJob construct, StepFunctions executes SageMaker batch transform job synchronously. In this case, StepFunctions add a tag (key: MANAGED_BY_AWS, value: STARTED_BY_STEP_FUNCTIONS) to the job, so state machine role needs the permission to do that. However, currently CDK does not add the permission automatically.

This PR solves the issue by adding sagemaker:AddTags permission to state machine role when RUN_JOB is specified as IntegrationPattern prop.

Closes #26012


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

…:AddTags permission for SageMakerCreateTransformJob task
@github-actions github-actions bot added the admired-contributor [Pilot] contributed between 13-24 PRs to the CDK label Sep 24, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team September 24, 2023 15:20
@github-actions github-actions bot added bug This issue is a bug. effort/medium Medium work item – several days of effort p2 labels Sep 24, 2023
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a 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.

@tam0ri tam0ri changed the title fix(aws-stepfunctions-tasks): state machine role is missing sagemaker:AddTags permission for SageMakerCreateTransformJob task fix(stepfunctions-tasks): state machine role is missing sagemaker:AddTags permission for SageMakerCreateTransformJob task Sep 24, 2023
@aws-cdk-automation aws-cdk-automation dismissed their stale review September 24, 2023 15:25

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a 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.

@tam0ri
Copy link
Contributor Author

tam0ri commented Sep 24, 2023

Exemption Request: There is no change against existing snapshots. Also, this is a small fix, so I didn't add a new integ test at this point. Please let me know if it's needed.

@aws-cdk-automation aws-cdk-automation added pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Sep 24, 2023
@sumupitchayan
Copy link
Contributor

Exemption Request: There is no change against existing snapshots. Also, this is a small fix, so I didn't add a new integ test at this point. Please let me know if it's needed.

@tam0ri I believe an integ test here would be useful.

@sumupitchayan sumupitchayan removed the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Oct 12, 2023
@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Oct 12, 2023
@aws-cdk-automation
Copy link
Collaborator

This PR has been in the CHANGES REQUESTED state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week.

@aws-cdk-automation aws-cdk-automation dismissed their stale review October 18, 2023 13:36

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Oct 18, 2023
Copy link
Contributor

@lpizzinidev lpizzinidev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks (and sorry for the late review) 👍
Looks good, just some minor adjustments are needed.

Comment on lines 285 to 286
);
policyStatements.push(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
);
policyStatements.push(

A single push call can be used for both statements.

@@ -306,3 +308,215 @@ test('create transform job with instance type supplied as JsonPath', () => {
},
});
});

test('required permmisions are granted to service role if RUN_JOB is supplied as service integration pattern', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test('required permmisions are granted to service role if RUN_JOB is supplied as service integration pattern', () => {
test('required permissions are granted to service role if RUN_JOB is supplied as service integration pattern', () => {

});
});

test('required permmisions are granted to service role if REQUEST_RESPONSE is supplied as service integration pattern', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test('required permmisions are granted to service role if REQUEST_RESPONSE is supplied as service integration pattern', () => {
test('required permissions are granted to service role if REQUEST_RESPONSE is supplied as service integration pattern', () => {

Comment on lines 8 to 9
super(scope, id, props);
const batch_inference_job = new SageMakerCreateTransformJob(this, 'Batch Inference', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
super(scope, id, props);
const batch_inference_job = new SageMakerCreateTransformJob(this, 'Batch Inference', {
super(scope, id, props);
const task = new SageMakerCreateTransformJob(this, 'BatchInferenceTask', {

});

new StateMachine(this, 'SimpleStateMachine', {
definitionBody: DefinitionBody.fromChainable(batch_inference_job),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
definitionBody: DefinitionBody.fromChainable(batch_inference_job),
definitionBody: DefinitionBody.fromChainable(task),

@tam0ri
Copy link
Contributor Author

tam0ri commented Oct 28, 2023

@lpizzinidev Thank you for your review! I pushed changes according to your comment. Could you review when you have some time?

Copy link
Contributor

@lpizzinidev lpizzinidev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks 👍

@aws-cdk-automation aws-cdk-automation added pr/needs-maintainer-review This PR needs a review from a Core Team Member and removed pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Oct 28, 2023
@vinayak-kukreja vinayak-kukreja self-assigned this Dec 7, 2023
Signed-off-by: Vinayak Kukreja <[email protected]>
Copy link
Contributor

@vinayak-kukreja vinayak-kukreja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @tam0ri , apologies for the delay. Thank you for contributing to AWS CDK.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: efe672f
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

mergify bot commented Dec 7, 2023

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
admired-contributor [Pilot] contributed between 13-24 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p2 pr/needs-maintainer-review This PR needs a review from a Core Team Member
Projects
None yet
5 participants