Spotinst Agent 2

raw JSON →
2.0.11 verified Mon Apr 27 auth: no python

Spectrum instance spotinst-agent that runs remote scripts, collects data, deploys applications, and more. Version 2.0.11, Python 3 only. Maintained by Spotinst.

pip install spotinst-agent-2
error ModuleNotFoundError: No module named 'spotinst_agent'
cause Installed wrong package or using old import.
fix
pip install spotinst-agent-2 and use 'from spotinst_agent_2...'
error AttributeError: 'NoneType' object has no attribute 'status'
cause Token missing or invalid.
fix
Check SPOTINST_TOKEN environment variable or token parameter.
breaking Python 2 is not supported; only Python 3.x is compatible.
fix Use Python 3.6+.
deprecated The old import 'from spotinst_agent import ...' is deprecated. Use 'spotinst_agent_2' package.
fix Change imports to spotinst_agent_2.
gotcha The token is required; if missing, scripts fail silently.
fix Set SPOTINST_TOKEN environment variable or pass token parameter.
gotcha Script execution is asynchronous; results may not be immediate.
fix Use callback or polling if needed.

Initialize the agent with a Spotinst token and run a script.

from spotinst_agent_2.agent import SpotinstAgent

agent = SpotinstAgent(token=os.environ.get('SPOTINST_TOKEN', ''))
result = agent.run_script('echo Hello from Agent')
print(result)