> For the complete documentation index, see [llms.txt](https://docs.unskript.com/unskript-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unskript.com/unskript-documentation/connnecting/proxies/connect-your-environment/runbooks-across-environments-serviceids.md).

# RunBooks Across Environments: ServiceIDs

## Running xRunBooks across Environments

Often, you'll need to run the same RunBook in multiple environments.  Using the ServiceId, the RUnBook remains the source of truth, and one RunBook run against multiple environments. &#x20;

To make this work, we'll move away from distinct credentials for each Action, and switch to ServiceIds:

<figure><img src="/files/2eHUJxBPOHKRr8utaCSq" alt=""><figcaption></figcaption></figure>

Before we get ahead of ourselves, let's take a step back and start from the beginning.

### Credential Setup

In each environment you wish to run the xRunBook in, you'll need a credential for each service.  For each of these credentials, create a ServiceId (that is the same across environments.)

{% hint style="info" %}
For example: you have an AWS credential in two environments: *dev* and *prod* with the names *AWS\_EC2\_dev* and *AWS\_EC2\_prod*. Give each of these credentials a serviceId (for example *AWS\_EC2).*
{% endhint %}

### xRunBook Setup

In order to run a xRunBook multiple environments, you'll need to 'Enable Environment Selection" on the RunBook Details page.

<figure><img src="/files/S3v4WIFaox92ytkpTrk9" alt="enable environment"><figcaption></figcaption></figure>

Next - open the xRunBook Editor.  For each Action change from Credential to serviceId, and select the serviceID.

Now, when you run the xRunBook, you'll need to add the environment as an input parameter.

## Example:

1. Navigate to xRunbooks, click the "unSkript xRunBooks" tab.
2. Search for IAM, and the "Create IAM User" will appear. Click the menu button to the right, and import this xRunBook into your proxy.

Now, open the xRunBook ("My xRunBooks" and it'll be at the top of the list).  Click the menu button, and pick "Open Details."  on this page, select the "Enable environment selection" checkbox:

<figure><img src="/files/KaHDd3AOGRpDebRq9fAc" alt="xRunBook with checkbox clicked"><figcaption></figcaption></figure>

Now, we can edit the Workflow - configuring each Action.  Click the Edit button.  For each Action, you can configure a SessionId for the Credential instead of the actual credential.\ <br>

<figure><img src="/files/K4cgxMNFVIaMxYYEoiW1" alt=""><figcaption></figcaption></figure>

Since the Credential is a variable that points to a credential in **BOTH** "test\_staging" and "test\_production", this xRunBook can be run in either environment.  Repeat for each Action in the xRunBook.

Save the xRunBook, and when you click "Run" in the xRunBook page, you will be prompted to choose the environment (or environments) you'd like to run the xRunBook:

<figure><img src="/files/vKe3EyeNUxsC4Vwe9vzd" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.unskript.com/unskript-documentation/connnecting/proxies/connect-your-environment/runbooks-across-environments-serviceids.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
