A bot is a non-human member of your organization, for scripts and automation. A bot can’t sign in: it acts through its API keys, and each key has exactly the bot’s access. People in your EZGH SSO directory can also use the console as a bot that trusts them. A bot can do nothing until policies are attached to it, directly or through a group.
Code running on a compute instance can use a bot too, with temporary keys the instance fetches itself.
Use a bot when code needs less access than the person who runs it, or needs access that doesn’t depend on one person staying in the organization.
Each bot has a name (1 to 100 characters), a bot ID like bot_a1b2c3d4e5f6, and a resource name like ezgh::org_…:bot_a1b2c3d4e5f6.
Create a bot
Creating a bot needs bots.create.
- Open IAM > Bots and select Create bot.
- Enter a Name.
- Select the Groups and Policies to start with. These steps appear only if you may change group members and attach policies.
- Select Create bot.
ezgh iam bots create deployer
ezgh iam policies attach ProjectsFullAccess --bot deployercurl https://orgs.ezghcloud.com/v1/organizations/$ORG_ID/bots \
-H "Authorization: Bearer $EZGH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "deployer"}'See CreateBot. Attach policies with AttachBotPolicy.
Create an API key for a bot
Creating a key for a bot needs bots.createApiKey on the bot. Whoever has it can act with the bot’s access, so treat it like policies.attach. You create bot keys signed in, in the console or the CLI; an API key can’t create API keys.
- Open IAM > Bots and select the bot.
- On the API keys tab, select Create API key.
- Enter a Name, choose when it Expires, review, then select Create key.
- Copy the key. It isn’t shown again.
ezgh iam api-keys create ci --bot deployer --expires-in-days 90The key is printed once, on standard output.
See API keys for key format, expiry and revocation.
Rename or delete a bot
On the bot’s page, select Rename (bots.update) or Delete (bots.delete). Deleting a bot deletes its API keys, which stop working at once, and removes it from its groups. With the CLI, use ezgh iam bots update <bot> --name <name> and ezgh iam bots delete <bot>.
The bot’s page also has a Groups tab and a Permissions tab, where you change its groups and directly attached policies as for a user.
Trust
A bot’s trust lists the EZGH SSO directory groups and users who may use the console as the bot, through console access. They sign in at your directory’s portal and get exactly the bot’s access; they never become members. Trust is empty for a new bot, so nobody can use the console as it.
On the bot’s page, the Trust tab lists the SSO groups and users that may sign in as the bot. Select Add to add some, or Remove on a row. Seeing the trust needs bots.get; changing it needs bots.updateTrust on the bot. A bot trusts at most 100 groups and users. Whoever has bots.updateTrust can let people act as the bot, so treat it like bots.createApiKey.
Trust doesn’t let anyone open the console on its own: they must also be assigned to your directory’s console application. EZGH SSO > Console access sets both. The API is GetBotTrust, UpdateBotTrust, AddBotTrust, RemoveBotTrust and ListBotTrust.
Trusted services
A bot’s Trusted services tab lists the services that may act as the bot for a repository and its refs. EZGH Build acts as a bot only where the bot trusts it: see Bots and trust. Seeing the list needs bots.get; adding and removing entries needs bots.updateTrust. The API is GetBotServiceTrust, AddBotServiceTrust and RemoveBotServiceTrust.
A bot used in the console can create API keys only when its policies allow bots.createApiKey on it. To stop the bots in a group creating keys for themselves, see API keys. People signed in as the bot can also get temporary API keys, which need no permission and end with their SSO session.