Operationalize your sandbox

Create a template you can integrate with your devops automation tool.

If you are considering adding the sandbox into an automation tool like Jenkins or Ansible, you can create a template that defines a sandbox configuration. For example, you are a site reliability engineer or developer and your goal is to quickly create a sandbox and test code changes. Follow these steps to learn how to create a file that defines the method for creating a sandbox and the origin mappings for your development environment.

How to

  1. Create a template similar to this:
    {
    	"sandbox": {
    		"clonable": true,
    		"properties": [{
    				"property": "prod.example.com:42",
    			}
    		]
    	},
    	"clientConfig": {
    		"sandboxServerInfo": {
    			"secure": false,
    			"port": 9550,
    			"host": "127.0.0.1"
    		},
    		"originMappings": [{
    			"from": "origin-www.example.com",
    			"to": {
    				"secure": false,
    				"port": 8080,
    				"host": "localhost"
    			}
    		}]
    	}
    }
    
    Note: In this example, the sandbox will be created from version 42 of prod.example.com, and all requests from origin-www.example.com will resolve to localhost port 8080 in the development environment.
  2. Modify the originMappings for your development environment, then save it with a JSON extension, for example: recipe.json.
  3. Run this command to create a sandbox based on that configuration:
    akamai sandbox create --recipe=/dev/recipe.json

What you should see

abc-zyx1:sandbox-cli ajones$ akamai sandbox create --recipe=/dev/recipe.json
validating recipe file
building origin list
Detected the following origins: www.ipqa-origin.com, dev.example.com
? Would you like the Sandbox Client to proxy these to the destination defined in the Akamai config? Yes
registering sandbox in local datastore
sandbox_id: e648cd49-6cd6-4659-99be-e88eeb155683 e648cd49-6cd6-4659-99be-e88eeb155683 is now active
Successfully created sandbox_id e648cd49-6cd6-4659-99be-e88eeb155683. Generated sandbox client configuration at /Users/ajones/Desktop/clihome/cache/sandbox-cli/sandboxes/e648cd49-6cd6-4659-99be-e88eeb155683/config.json please edit this file

Next steps

Use Sandbox to test site and property changes.