未提供项目描述
项目描述
不要忘记您的AWS实例!
anti_forgetful 是一个简单便捷的工具,可以从终端启动单个AWS实例,并将其生命周期与启动它的机器上的进程生命周期绑定。这有助于避免忘记实例并将其运行一个月的情况。那可能需要成千上万美元!
如果遇到问题,请告诉我!
只需告诉我如何使用它!
首先,如果您以前没有使用过AWS
设置您的AWS账户。
按照以下前两个步骤(“安装AWS CLI”和“配置AWS CLI”) 在此处。
接下来,安装 anti_forgetful
pip install anti_forgetful
现在,查看 example 文件夹以获取启动Jupyter笔记本服务器的示例。要开始构建您的实例,请转到该目录并运行
anti_forgetful awscfg
这告诉启动器使用 awscfg.py 作为您的配置文件,并开始构建您的实例。在免费的 t2.micro 实例上需要几分钟。几分钟后
那么我该如何编写这些配置文件之一呢!
配置指定为Python文件
# The name of the public/private key pair and the security group created for
# your instance. If this key already exists, it won't be recreated.
key_pair_name = 'tutorial_key_pair'
group_name = 'tutorial_group'
# What instance type do you want? https://aws.amazon.com/ec2/instance-types/
instance_type = 't2.micro'
# This option turns off strict host checking in SSH. This can be handy if you
# aren't worried about security and want to avoid some manual interaction
# launching your instance.
no_strict_host_checking = True
# The base image to build from. You probably shouldn't change this.
base_image_id = 'ami-428aa838'
# The disk size requested from AWS EBS. In GB.
root_volume_size = 30
# Your instance will be given a name so that it can be started and stopped!
# Two instances with the same name could get messy... You've been warned.
instance_name = 'tutorial_instance'
# This function is run once when your instance is built. Build your docker
# images here or install any packages you might want.
def setup_images(s):
# Copy a file from the local machine to the instance. Accepts an optional
# parameter "dest_filepath" for remote destination.
s.copy_to_remote('docker-compose.yml')
# Run a shell command on the remote instance.
s.run_cmd('docker-compose pull')
# This function is run every time your instance boots up.
def start_containers(s):
# Forward a port from the remote machine to the local machine through an
# ssh tunnel.
s.ssh_port_forward(8888, 8888)
# Star the docker containers!
s.run_cmd('docker-compose up')
以防万一您需要终止某些实例。
使用 awsterminate 命令可以列出您当前正在运行的所有实例,并为您提供终止它们的选项。
其他
目前,它与Docker完全集成。这可以很容易地更改。
我只在Ubuntu上尝试过Python 3.5和Python 3.6。
项目详情
关闭
anti_forgetful-18.4.24.4.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | b08279c637f2dafd657e05865ca593a869d70e805855f3c4075d137579bce40c |
|
MD5 | 34768a7b7124629f4731179a4cd4b04c |
|
BLAKE2b-256 | edfd76fbecdc2c827270c5614fc777848592a3dead18703d62b6b01c9d23c612 |