0

I am creating an iOS app that will query my database without doing any object manipulation or calculation, I can do this in several ways:

  1. Query directly using DynamoDB iOS SDK

  2. Query using AWS Lambda iOS SDK, and then executing a lambda function that queries DynamoDB directly.

My question is, which is more execution-time and cost efficient?

My thoughts are that option 1 is the best as it does not require a function or any execution time.

I know that I am charged for the DynamoDB query and I know that I am charged for the execution time of the lambda function. However, I am not sure if I will be charged for using the DynamoDB SDK method or for something else or if I might forgetting another possible cost or thing that I am not taking into account.

Thank you.

3 Answers 3

1

Using DynamoDB is cheaper, but it has serious (in my opinion) drawbacks:
- Security. You need to figure out how to manage users of your app accessing your DynamoDB, likely by using Cognito.
- Complexity. This has to do with security. You have to come up with security policies which can be hard.
- Vendor lock-in. You are tying your app to the DynamoDB proprietary SDK. If tomorrow you decide to switch to a SQL database or some other NoSQL service you will have a hard time.
Using lambda with API gateway as a Middleware to DynamoDB overcomes most of the issues and enables you to use your own authorization mechanism (not necessarily AWS policies).

Sign up to request clarification or add additional context in comments.

Comments

0

Your thought is correct, executing the query using DynamoDB IOS SDK is better for execution time and cost.

Additionally you will be charged for data transfer (for both approaches).

However its not advisable to store the Access Keys & Secrets inside IOS app, where you need to consider using temporary security credentials possibly with AWS Cognito.

Comments

0

DynamoDB has a issue with Security - Dynamo DB does not have a VPC endpoint yet. Hence its better to go for redis elastic cache if you have VPC endpoint restrictions.

VPC - Virtual private cloud

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.