Skip to content
v2.274.0

HttpSqsIntegrationProps Struct ​

Properties to initialize HttpSqsIntegration.

Example ​

ts
import * as sqs from 'aws-cdk-lib/aws-sqs';
import { HttpSqsIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';

declare const queue: sqs.IQueue;
declare const httpApi: apigwv2.HttpApi;

// default integration (send message)
httpApi.addRoutes({
  path: '/default',
  methods: [apigwv2.HttpMethod.POST],
  integration: new HttpSqsIntegration('defaultIntegration', {
    queue,
  }),
});
// send message integration
httpApi.addRoutes({
  path: '/send-message',
  methods: [apigwv2.HttpMethod.POST],
  integration: new HttpSqsIntegration('sendMessageIntegration', {
    queue,
    subtype: apigwv2.HttpIntegrationSubtype.SQS_SEND_MESSAGE,
  }),
});
// receive message integration
httpApi.addRoutes({
  path: '/receive-message',
  methods: [apigwv2.HttpMethod.POST],
  integration: new HttpSqsIntegration('receiveMessageIntegration', {
    queue,
    subtype: apigwv2.HttpIntegrationSubtype.SQS_RECEIVE_MESSAGE,
  }),
});
// delete message integration
httpApi.addRoutes({
  path: '/delete-message',
  methods: [apigwv2.HttpMethod.POST],
  integration: new HttpSqsIntegration('deleteMessageIntegration', {
    queue,
    subtype: apigwv2.HttpIntegrationSubtype.SQS_DELETE_MESSAGE,
  }),
});
// purge queue integration
httpApi.addRoutes({
  path: '/purge-queue',
  methods: [apigwv2.HttpMethod.POST],
  integration: new HttpSqsIntegration('purgeQueueIntegration', {
    queue,
    subtype: apigwv2.HttpIntegrationSubtype.SQS_PURGE_QUEUE,
  }),
});

Properties ​

parameterMappingoptionalParameterMappingparameter_mappingoptionalParameterMappingparameterMappingoptionalParameterMappingParameterMappingoptionalParameterMappingParameterMappingoptionalParameterMapping#
Specifies how to transform HTTP requests before sending them to the backend.

Default: specify QueueUrl. Additionally, set MessageBody to $request.body.MessageBody for SQS_SEND_MESSAGE subtype and set ReceiptHandle to $request.body.ReceiptHandle for SQS_DELETE_MESSAGE subtype.

queueIQueuequeueIQueuequeueIQueueQueueIQueueQueueIQueuerequired#
SQS queue that Integrates with API Gateway.
subtypeoptionalHttpIntegrationSubtypesubtypeoptionalHttpIntegrationSubtypesubtypeoptionalHttpIntegrationSubtypeSubtypeoptionalHttpIntegrationSubtypeSubtypeoptionalHttpIntegrationSubtype#
The subtype of the HTTP integration.

Default: HttpIntegrationSubtype.SQS_SEND_MESSAGE

Only subtypes starting with SQS_ can be specified.