title: Caching results of a lambda function
body: <p>We are developing a serverless application. The application has &quot;users&quot; that get added, &quot;groups&quot; that have &quot;permissions&quot; on different &quot;resources&quot;. To check if a user has permission to do an action on a resource, there would be some calculations we will need to do. (We are using DynamoDB)</p>
  <p>Basically, before every action, we will need to check if the user has permission to do that particular action on the given resource. I was thinking we could have a lambda function that checks that from a cache and If not in the cache, hits the DB, does the calculation, writes in the cache, and returns.</p>
  <p>What kind of cache would be best to use here? We are going to be calling this internally from the backend itself.</p>
  <p>Is API gateway the way to go still?</p>
  <p>How about elastic cache for this purpose? Can we use it without having to configure a VPC? We are trying not to have to use a VPC in our application.</p>
  <p>Any better ways?</p>