CLI
build
CLI
build
Build your infrastructure and run your code using alto build
Usage
alto build
combines the functionality of alto apply and alto run. That is, it:
- Builds (or rebuilds) your agent using the information in your agent’s configuration YAML, and
- Executes your code on your cloud environment.
We recommend using this command in lieu of
alto apply
&& alto run
.Usage: alto run [OPTIONS]
Build your agent using a configuration YAML and then run your project on the
newly created agent.
Examples:
• alto build -f ./ec2.yml --no-delete-failure
• alto build -f ./ec2.yml --no-delete-success --whitelist-all
╭- Options --------------------------------------------------------------------------------------------------------------------------------╮
| * --file -f TEXT Alto configuration file. |
| [required] |
| --name TEXT Name of agent within Alto configuration file. |
| --verbose -v Log all activity after command execution according to --log-level. [default: False] |
| --log-level -l [info|warn|error|debug] Set the log level. [default: info] |
| --no-delete-failure Preserve the cloud resources after a failed run. [default: False] |
| --no-delete-success Preserve the cloud resources after a successful run. [default: False] |
| --whitelist-all Whitelist all IP addresses. If False, then only whitelist your current IP address. |
| [default: False] |
| --help Show this message and exit. |
╰------------------------------------------------------------------------------------------------------------------------------------------╯
Important: just as with the the
apply
command, sequential calls of this command
allow you to propagate any local code changes to your cloud environment.Example
alto build
will stream the logs associated with building your agent as well as
whatever logs are produced by your code:
$ alto build -f nomad.yml --verbose
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Created key pair my-new-ec2-agent
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Created security group with ID sg-XXXXXXXXXXXXXXXXX in VPC vpc-XXXXXXXXXXXXXXXXX
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Created EC2 instance with ID i-XXXXXXXXXXXXXXXXX
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Instance i-XXXXXXXXXXXXXXXXX is pending... checking again in 5 seconds
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Instance i-XXXXXXXXXXXXXXXXX is pending... checking again in 5 seconds
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Instance i-XXXXXXXXXXXXXXXXX is pending... checking again in 5 seconds
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Instance i-XXXXXXXXXXXXXXXXX is pending... checking again in 5 seconds
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Instance i-XXXXXXXXXXXXXXXXX is pending... checking again in 5 seconds
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Instance i-XXXXXXXXXXXXXXXXX is pending... checking again in 5 seconds
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | SSH connection refused. Retrying in 5 seconds...
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | SSH connection refused. Retrying in 5 seconds...
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | SSH connection succeeded!
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | , #_
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | ~\_ ####_ Amazon Linux 2023
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | ~~ \_#####\
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | ~~ \###|
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | ~~ \#/ ___ https://aws.amazon.com/linux/amazon-linux-2023
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | ~~ V~' '->
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | ~~~ /
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | ~~._. _/
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | _/ _/
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | _/m/'
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Requirement already satisfied: pip in ./.venv/function/lib/python3.9/site-packages (21.3.1)
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Collecting pip
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Downloading pip-23.2.1-py3-none-any.whl (2.1 MB)
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Installing collected packages: pip
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Attempting uninstall: pip
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Found existing installation: pip 21.3.1
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Uninstalling pip-21.3.1:
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Successfully uninstalled pip-21.3.1
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Successfully installed pip-23.2.1
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Collecting boto3 (from -r requirements.txt (line 1))
...
...
...
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Installing collected packages: urllib3, six, jmespath, python-dateutil, botocore, s3transfer, boto3
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Successfully installed boto3-1.28.52 botocore-1.31.52 jmespath-1.0.1 python-dateutil-2.8.2 s3transfer-0.6.2 six-1.16.0 urllib3-1.26.16
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Updating remote project and file paths
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Copied project directory into instance
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Updated environment variable AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXXXXX
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Updated environment variable AWS_SECRET_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Updated environment variable AWS_DEFAULT_REGION=XX-XXXX-X
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Done updating remote project and file paths
<HH:MM:SS> | INFO | my-new-ec2-agent[build] | Pseudo-terminal will not be allocated because stdin is not a terminal.
<HH:MM:SS> | INFO | my-new-ec2-agent[run] | This was logged by my code!