跳转到主要内容

未提供项目描述

项目描述

不要忘记您的AWS实例!

anti_forgetful 是一个简单便捷的工具,可以从终端启动单个AWS实例,并将其生命周期与启动它的机器上的进程生命周期绑定。这有助于避免忘记实例并将其运行一个月的情况。那可能需要成千上万美元!

如果遇到问题,请告诉我!

只需告诉我如何使用它!

首先,如果您以前没有使用过AWS

  1. 设置您的AWS账户。

  2. 按照以下前两个步骤(“安装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 (5.6 kB 查看哈希值)

上传时间 源代码

由以下支持