I'm trying to use with api gateway to run dynamo queries. I 'm using a cloudformation template to create it. I create it using an apigateway method but I don't know how to define a name to access the service like /sender. Now I can access the service at / . And also I don't know hot to define OPTIONS method for this service. Any help is welcome!
Sender:
Type: 'AWS::ApiGateway::Method'
Properties:
OperationName: Sender-dev
RestApiId: !Ref myApiSite
ResourceId: !GetAtt
- myApiSite
- RootResourceId
HttpMethod: PUT
AuthorizationType: NONE
Integration:
Type: AWS
Uri: "arn:aws:apigateway:us-east-1:dynamodb:action/PutItem"
IntegrationHttpMethod: POST
Credentials: "arn:aws:iam::710072603473:role/dynamo-full"
If you don't want to use lambda function as a proxy, but directly integrate API Gatway with DynamoDB, then you have to create all the template mappings, and request data mappings for that to work.
I don't have a ready-made-example for DynamoDb, but a good start would be through implementing official AWS tutorial for kinesis in CloudFormation.
The tutorial works and is doable in CloudFormation. I know, because I've done it. The tutorial is very useful, as it shows how to setup all the mappings for direct integration of API gateway and Kinesis. Obviously, you would have to then adjust it for DynamoDB, which wouldn't be that difficult if you will understand how to work with Kinesis.
The alternative would be to use Lambda as a proxy between API Gateway and DynamoDB.