|
| 1 | +# Component: `spotinst-integration` |
| 2 | + |
| 3 | +This component is responsible for provisioning the IAM policies, roles, and instance profile for integrating an account with [Spotinst](https://spot.io/). |
| 4 | + |
| 5 | +See the [documentation on configuring Spotinst here](./spotinst-configuration.md) for full details on obtaining a Spotinst API Key and providing that to the account. |
| 6 | + |
| 7 | +## Usage |
| 8 | + |
| 9 | +This component cannot be installed via Atlantis because it requires multiple manual interventions. |
| 10 | +The procedure in [spotinst-configuration.md](./spotinst-configuration.md) |
| 11 | +also does not work because it assumes a late 2021 (`atmos`, stacks, etc.) |
| 12 | +environment. |
| 13 | + |
| 14 | +The procedure in [spotinst-manual-configuration.md](./spotinst-manual-configuration.md) |
| 15 | +to set up Spotinst is closer, but still not quite, because it too assumes |
| 16 | +there is a `namespace`-gbl-`stage`-helm role to use, which we |
| 17 | +do not have, and it assumes we have a paid account, which we do not. |
| 18 | + |
| 19 | +So this set up is very manual, but you can leverage the tools |
| 20 | +in [spotinst-manual-configuration.md](./spotinst-manual-configuration.md) to help. |
| 21 | + |
| 22 | +Basic steps: |
| 23 | + |
| 24 | +- Get an Admin API token for Spotinst (via the web UI) and save it in an environment variable. |
| 25 | +- Create a Spotinst account for this AWS account (via `curl`). Except on the free plan, we can only have 1 account, |
| 26 | +and it has already been created. |
| 27 | +- Create (via `curl`) a programmatic user and associated API token and save the token in SSM. |
| 28 | +Actually, we do not need to save it in SSM, but it is handy there. |
| 29 | +Where it really needs to go is in a GitHub Secret as `SPOTINST_TOKEN`. |
| 30 | +- Create an "external ID" for the Spotinst API role and save it in SSM. |
| 31 | +- Run `terraform apply` to provision: |
| 32 | + - An IAM Role for Spotinst API to use to manage resources in the account |
| 33 | + - An IAM Role to give the EKS installed Ocean Controller the access it needs |
| 34 | + - An EC2 Instance Profile to assign the Ocean Controller IAM Role to an instance |
| 35 | +- Configure (via `curl`) the Spotinst API to use the API IAM Role |
| 36 | + |
| 37 | +When done, the Spot.io Dashboard should show that the account status is "connected". |
| 38 | + |
| 39 | + |
0 commit comments