Cmpute.io is now a part of Cisco. Learn More

About Cisco

Shutdown Script

Shutdown Script

A user defined script which cmpute will execute before instances are terminated.

Below are the steps to follow before providing shutdown script for execution in a job:

  1. The job in cmpute should have an ‘Instance Profile’ associated with it. This instance profile should have access to s3 bucket in your AWS account.

  2. Create a file named ‘config’ which should contain json structure having cmpute domain, cmpute access key and cmpute secret key

    Note: The Access key and Secret key can be created from settings tab in your cmpute platform)

    Example

            {
            "tenant_url" : "https://<customer-domain>.cmpute.io",
            "api_key" : "api key", 
            "secret_key" : "secret key"
            }
    
  3. Upload the ‘config’ file to the s3 bucket in your AWS account

  4. While creating the job in your cmpute platform, in the Launch script text box, include the following lines as the starting lines:

For Linux

        #!/bin/bash
        aws s3 cp s3://bucket/key/config {path-to-config} --region {region}
        aws s3 cp s3://shutdownscript/linux/shutdownscript {path-to-store-it} --region us-east-1
        chmod +x {path-to-shutdownScript} 
        {path-to-shutdownScript} {path-to-config} &

For Windows

        aws s3 cp s3://bucket/key/config {path-to-config} --region {region}
        aws s3 cp s3://shutdownscript/windows/shutdownscript.exe {path-to-store-it} --region us-east-1
        {path-to-shutdownScript} {path-to-config}