forked from bellwether/minerva
32 lines
1 KiB
Python
32 lines
1 KiB
Python
import minerva
|
|
|
|
m = minerva.Minerva("hay")
|
|
pier = m.pier(subnet_id = "subnet-05eb26d8649a093e1", # project-subnet-public1-us-east-1a
|
|
sg_groups = ["sg-0f9e555954e863954", # ssh
|
|
"sg-0b34a3f7398076545"], # default
|
|
iam = "S3+SSM+CloudWatch+ECR",
|
|
key_pair = ("Ari-Brown-HAY", "~/.ssh/Ari-Brown-HAY.pem"))
|
|
|
|
|
|
def worker(pier, n=0):
|
|
mach = pier.machine(ami = "ami-0399a4f70ca684620", # dask on ubuntu 22.04 x86
|
|
instance_type = "t3.medium",
|
|
username = "ubuntu",
|
|
name = f"test-{n}",
|
|
disk_size = 32,
|
|
variables = {"type": "worker",
|
|
"number": n})
|
|
return mach
|
|
|
|
mach = worker(pier)
|
|
|
|
mach.create()
|
|
mach.login()
|
|
print("*******")
|
|
print(repr(mach.cmd("echo 'hello world'").stdout))
|
|
print("*******")
|
|
print(mach.cmd("echo I am machine $number of type $type"))
|
|
print("*******")
|
|
mach.terminate()
|
|
print(f"{mach.info['InstanceId']}: ${mach.cost()}")
|
|
|