0

I am trying to use ElastiCache with a Spring app that is supposed to be deployed as a worker application in a worker environment on AWS.

The app has a a cron job which should run every 5 minutes and update some data on ElastiCache. The cron.yaml is defined as:

version: 1
cron:
 - name: "memcache-dataset-update-job"
   url: "/runcron"
   schedule: "0/5 * * * *"

"/runcron" calls the following method:

@RequestMapping(method = RequestMethod.GET)
@ResponseStatus(value = HttpStatus.OK)
public void updateDataSet(){

    try {
        dataSet = initializeNewDataSet();

        memcached = new MemcachedClient(new BinaryConnectionFactory(ClientMode.Dynamic), 
                AddrUtil.getAddresses(memcacheConfigEndpoint));
        // Store a value (async) for one hour
        memcached.set(dataSetKey, 1800, dataSetObject);
    }

My question: 1. Should the request mapping be for http POST? 2. Do I need to define permissions in the IAM worker role to allow my app access to ElastiCache. If yes, how? I could not find any help here on AWS docs.

Syed
  • 340
  • 1
  • 3
  • 13

1 Answers1

0

I found answer to my own questions: 1. Request mapping should be for HTTP POST method. 2. No permissions need to be defined in the IAM worker role for ElastiCache access. Just that the app should be within the same VPC as your cache cluster.

Syed
  • 340
  • 1
  • 3
  • 13