如何在办公时间开启/关闭云实例 [英] How to turn on/off cloud instances during office hours

查看:23
本文介绍了如何在办公时间开启/关闭云实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始在 AWS、Azure 和 Rackspace 中创建云实例.但是,我需要在一天结束时关闭我的实例并在早上打开,因为这将使我的托管成本减半(它们用于开发).

I've got my head around creating cloud instances in AWS, Azure and Rackspace. However, I need to turn my instances off at the end of the day and on in the morning as this will half my hosting cost (they are for development).

我看过一些管理服务,但它们让我大吃一惊.有没有简单的方法可以做到这一点?

I've looked at a few management services but they blew my brains out. Is there a simple way to do this?

推荐答案

方法

您始终可以推出自己的解决方案,因为大多数云提供商都提供相应的 API 来按需(甚至按计划)启动/停止实例,这当然也是这些管理服务实际使用的 - AmazonEC2 Java 接口提供了所有相关方法示例(以及许多其他示例),特别是:

Approach

You could always roll your own solution, insofar most cloud providers offer a respective API to start/stop instances on demand (or even on schedule), which is what those management services are actually using as well of course - the AmazonEC2 Java interface offers all relevant methods for example (amongst many others), specifically:

关于 Amazon EC2 的最简单方法是自己制作一些 Python 脚本出色的boto (提供当前和未来基础设施服务的集成接口由 Amazon Web Services 提供),它公开了上述所有 EC2 方法;然后,您可以按需或通过操作系统调度程序启动这些脚本.

The most simple approach for this regarding Amazon EC2 would be to craft yourself some Python scripts by means of the excellent boto (An integrated interface to current and future infrastructural services offered by Amazon Web Services), which exposes all EC2 methods mentioned above; you could then start those scripts on demand or via your operating system scheduler.

另一种选择是促进持续集成服务器作为自动化引擎(这些系统有时会被忽视的一个方面),以防万一你碰巧运行了一个;它允许您按需启动/停止实例或类似于 cron 调度.

Another option would be to facilitate a continuous integration server as an automation engine (a sometimes overlooked aspect of these systems), in case you happen to run one anyway; it would allow you to both start/stop instances on demand or scheduled similar to cron.

我们正是通过 Bamboo AWS 插件(它是开源的和 代码在 Bitbucket 上可用),请参阅我对 如何在 java 中以编程方式启动和停止 Amazon EC2 实例 以获取有关此方法的更多详细信息.而 Atlasian 应该有商业产品类似的可用于流行的开源 CI 解决方案,例如Jenkins 也是如此.

We do exactly this by means of the Bamboo AWS Plugin (it's Open Source and the code is available on Bitbucket), see my answer to How to start and stop an Amazon EC2 instance programmatically in java for more details on this approach. While Atlassian Bamboo is a commercial offering, there should be something similar available for popular Open Source CI solutions like e.g. Jenkins as well.

这篇关于如何在办公时间开启/关闭云实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆