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(aws-apigateway-sagemakerendpoint): New aws-apigateway-sagemakerendpoint pattern implementation #87

Merged
merged 5 commits into from
Oct 16, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update comment not to exceed line limit
dscpinheiro committed Oct 13, 2020
commit 235fa5ea58b64103a65e605cb9c66f9aa30f7748
Original file line number Diff line number Diff line change
@@ -98,11 +98,12 @@ export class ApiGatewayToSageMakerEndpoint extends Construct {
// Setup the IAM policy for SageMaker endpoint
const invokePolicy = new iam.Policy(this, 'InvokeEndpointPolicy', {
statements: [
new iam.PolicyStatement({
actions: ['sagemaker:InvokeEndpoint'],
resources: [`arn:${Aws.PARTITION}:sagemaker:${Aws.REGION}:${Aws.ACCOUNT_ID}:endpoint/${props.endpointName}`]
})
]});
new iam.PolicyStatement({
actions: ['sagemaker:InvokeEndpoint'],
resources: [`arn:${Aws.PARTITION}:sagemaker:${Aws.REGION}:${Aws.ACCOUNT_ID}:endpoint/${props.endpointName}`]
})
]
});

invokePolicy.attachToRole(this.apiGatewayRole);

@@ -134,7 +135,8 @@ export class ApiGatewayToSageMakerEndpoint extends Construct {
{ statusCode: '400', selectionPattern: '4\\d{2}' }
);

// The SageMaker integration can be added either at the root of the API (GET https://execute-api.amazonaws.com/{some-param}), or as a sub-resource (GET https://execute-api.amazonaws.com/inference/{some-param}).
// The SageMaker integration can be added either at the root of the API (GET https://execute-api.amazonaws.com/{some-param}),
// or as a sub-resource (GET https://execute-api.amazonaws.com/inference/{some-param}).
// The following lines will make sure only the necessary resources are created.
let apiResource = this.apiGateway.root;
if (props.resourceName !== undefined) {