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

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

问题描述

我有我的头围绕创建于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来启动/停止按需实例(甚至按计划),这是这些管理服务的使用,当然究竟是什么,以及 - 的<一个href="http://docs.amazonwebservices.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/ec2/AmazonEC2.html">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:

  • <一个href="http://docs.amazonwebservices.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/ec2/AmazonEC2.html#startInstances%28com.amazonaws.services.ec2.model.StartInstancesRequest%29">StartInstances()
  • <一个href="http://docs.amazonwebservices.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/ec2/AmazonEC2.html#stopInstances%28com.amazonaws.services.ec2.model.StopInstancesRequest%29">StopInstances()
  • <一个href="http://docs.amazonwebservices.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/ec2/AmazonEC2.html#rebootInstances%28com.amazonaws.services.ec2.model.RebootInstancesRequest%29">RebootInstances()
  • StartInstances()
  • StopInstances()
  • RebootInstances()

有关这对于亚马逊EC2 最简单的方法是由优秀的手段<一个手艺自己的一些Python脚本HREF =HTTP://$c$c.google.com/p/boto/>博托的(集成的接口,以当前和未来的亚马逊网络服务提供基础设施服务)的,这暴露了上面提到的所有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.

我们做的正是这样的竹AWS插件(它是开源的手段和的$c$c可在到位桶),请参阅我的回答的如何启动和编程停止Amazon EC2实例在Java 查找有关此方法的更多信息。虽然<一href="http://www.google.com/url?sa=t&rct=j&q=atlassian%20bamboo&source=web&cd=1&ved=0CDgQFjAA&url=http://www.atlassian.com/software/bamboo&ei=zPofT5-pDciq-Abp7YjEBA&usg=AFQjCNGRtgSKFoF6YTmc4ZB4-lcvzP754g&cad=rja">Atlassian竹是一个商业产品,应该有类似的东西可以流行的开源CI解决方案,例如像<一href="https://bitbucket.org/utoolity/bamboo-aws-plugin/src/ef5a1a97df2c/src/main/java/net/utoolity/bamboo/plugins/EC2Task.java#cl-233">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天全站免登陆