6

I need to communicate elasticache(Redis engine) using AWS API gateway. I successfully connected the ElastiCache from lambda function in the same VPC. I cant connect from outside VPC.

So I tried to create an API gateway, and select integration type as AWS Service Proxy and AWS Service as ElastiCache.

This is the screenshot for creating an API gateway

screenshot

But I don't know, how to test this created API for executing Redis commands.

eg: SET A FOO

is it possible to communicate ElastiCache using API gateway?

johnmcaliley
  • 11,015
  • 2
  • 42
  • 47
Abdul Manaf
  • 4,933
  • 8
  • 51
  • 95
  • How did you connect to Elasticache using Lambda. I am facing issue in connecting lambda to Elasticache Redis cluster. Can you please help? – Avani Khabiya Dec 16 '20 at 16:13

1 Answers1

10

API Gateway service proxy is for proxying the AWS API, not the Redis API, so that's not going to work for you. You will have to create a Lambda function and use API Gateway Lambda integration.

Mark B
  • 183,023
  • 24
  • 297
  • 295
  • how would this work with VPC? There are some sporadic notes stating that ElastiCache can be made without VPC, but running VPC alone and running an NAT gateway would be costlier, and to run Redis and say other services like dynamodb along at the same time would prove to be much costlier. Is there a cheaper way? – sandeepzgk Jun 23 '16 at 09:59
  • i need to know how its done by using only Api gateway. question updated. – Abdul Manaf Jun 23 '16 at 10:13
  • 1
    It **can not** be done by only using API Gateway. I thought I made that perfectly clear in my answer. You are confusing the purpose of AWS Service Proxy. It can't be used for querying Redis. Regarding VPC, you can't use ElastiCache without VPC, and you would need to enable VPC access for the Lambda function. You would not need to add a NAT gateway unless you wanted to do things with your Lambda function that required access to resources outside your VPC. – Mark B Jun 23 '16 at 14:16