Integrate your sandbox with 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.

  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"
                }
            }]
        }
    }
    

📘

In this example, the sandbox will be created from version 42of prod.example.com, and all requests from origin-www.example.comwill resolve to localhost port 8080in the development environment.

  1. Modify the originMappingsfor your development environment, then save it with a JSON extension, for example: recipe.json.

  2. Run this command to create a sandbox based on that configuration:
    akamai sandbox create --recipe=/dev/recipe.json

You'll see a response like this:

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

👍

You can use Sandbox to test site and property changes.