Automic Workload Automation

Expand all | Collapse all

Trigger job in AWS cloud by using REST API Oauth option

Jump to Best Answer
  • 1.  Trigger job in AWS cloud by using REST API Oauth option

    Posted 02-19-2020 07:04 PM
    Hi Team,
    We are planning to use REST API Oauth option to trigger job in AWS cloud. After starting the job in cloud server by using oauth option, how can we get the response back into automic without read or connection timeout? Because app team don't want to wait for the response until job completes. Instead check the response after periodic interval. How can make this happen in Automic Web Interface?

    Note: Currently Automic resides in on-premises.

    Thanks,
    Prakash S


  • 2.  RE: Trigger job in AWS cloud by using REST API Oauth option
    Best Answer

    Posted 02-20-2020 01:32 PM
    Hi Prakash,

    Some web services I have worked with give the user a token which have a varying lifespan.  The work being done by the cloud service should give a session or job id.  Determine the best guess of the runtime of that job and start checking at that time, then every minute thereafter until done.

    You can set up a subworkflow that accepts the necessary parameters and does the above until the job ends.

    You can set this up on a post condition of your job submission task.  It depends on the exact use case and where you want reports etc.

    Most rest based api submissions operate on this very premise.  Trigger them, get an id, come check the id periodically until satisfied.  Even automic itself does the same when you activate it by rest, it gives the runid immediately and you are left to poll that id for end status.

    If your webservice gives you an expiring token you may have to renew that in some manner, that is a different topic.

    --

    Scott Hughes

    IT Network Services

    O 949 286 7668
    M 505 373 7872
    7000 Central Blvd SW
    Albuqurque
    Albuqurque, New Mexico 87121






  • 3.  RE: Trigger job in AWS cloud by using REST API Oauth option

    Posted 02-20-2020 02:54 PM
    Thanks Scott for the details. Appreciate it.
    Couple of questions
    1) You said below.

    You can set this up on a post condition of your job submission task.  It depends on the exact use case and where you want reports etc.
    Here you mean capture the parameter with the script and end the job based on the specific value?

    2) You said below:

    Most rest based api submissions operate on this very premise.  Trigger them, get an id, come check the id periodically until satisfied.  Even automic itself does the same when you activate it by rest, it gives the runid immediately and you are left to poll that id for end status.

    If i give connection time out as 0 then it will check the response until it matches otherwise it will keep waiting. What is the default polling interval? I did not find much documentation about this topic anywhere. Can we change the polling interval? If so how?

    Thanks,
    Prakash S


  • 4.  RE: Trigger job in AWS cloud by using REST API Oauth option

    Posted 02-26-2020 09:23 AM
    Most rest webservice requests are 2 jobs minimum.  1 to submit, 1 to check the results.  The submit job normally gives you back a token to represent your submission.  You use that token in the check job.  You can run the check job on restart as a post condition.  You can check as often as a minute.

    ------------------------------
    Scott Hughes
    Senior Automation Engineer
    Verizon
    Albuquerque, NM
    ------------------------------



  • 5.  RE: Trigger job in AWS cloud by using REST API Oauth option

    Posted 02-26-2020 06:58 PM
    Thanks Scott. We are going to use Oauth okta connection to setup the API job. Can you tell me how the same authorization token used to trigger and check status of the job? Is there any job id or any unique key will be returned from the web services for the same token? We yet to start the job setup. Just gathering few details in advance.

    Thanks,
    Prakash S


  • 6.  RE: Trigger job in AWS cloud by using REST API Oauth option

    Posted 02-27-2020 09:24 AM
    I have no idea how your app might work.  I worked with an app that you sent it user and pwd and it sent back a token which lasted for an hour.  We recorded that to an object variable and used it for the next hour, even had a preprocess to renew it when needed.

    The firewall api I work against gives me a ten minute session without a token.  I login once then can use the api for ten minutes, every action I take renews the ten minutes.  I put a 9 minute loop in to check status to keep the session alive.

    Both of the above scenarios still work on premise of accepting a job submission and handing back a 'jobid' which we interrogate for status.

    --

    Scott Hughes

    IT Network Services

    O 949 286 7668
    M 505 373 7872
    7000 Central Blvd SW
    Albuqurque, New Mexico 87121






  • 7.  RE: Trigger job in AWS cloud by using REST API Oauth option

    Posted 02-28-2020 04:05 PM
    Thanks Scott. We will explore the options.