等待AWS EC2实例停止或开始完成 [英] Awaiting AWS EC2 instance stop or start completion

查看:202
本文介绍了等待AWS EC2实例停止或开始完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过AWS EC2 API发送一个请求,以停止(或启动)实例,然后在计算机处于stopped状态(或running)时获得回调.

I would like to send a request through the AWS EC2 API to stop (or start) an instance and then get a callback when the machine is in the stopped state (or running).

我正在使用适用于.NET的AWS开发工具包,并且尝试了ec2Client.StopInstancesAsync方法.请求发布后立即返回,因此在状态转换后不会进行异步回调.

I'm using the AWS SDK for .NET, and I've tried the ec2Client.StopInstancesAsync method. It returns as soon as the request has posted, so it does not make an asynchronous callback after the state transition.

我的总体目标是停止实例,在计算机为stopped后更改InstanceType,然后启动实例.看来,执行此操作的唯一方法可能是发出停止请求,启动我自己的轮询机制以观察实例状态转换为stopped,然后在完成后继续进行InstanceType更改.

What I'm aiming to do overall is to stop an instance, change the InstanceType once the machine is stopped, then start the instance. It appears the only way to do this might be to make the stop request, start my own polling mechanism to watch the instance state transition to stopped, then continue with the InstanceType change once it has completed.

我想认为有一种更简单,更轻松的方式来等待过渡完成.有人知道EC2状态转换完成后会收到通知的方式吗?

I'd love to think there's a simpler, less chatty way of waiting for the transition to complete. Does anyone know of a way to be notified when an EC2 state transition has completed?

推荐答案

答案似乎是否定的. EC2实例转换完成后,似乎没有任何方法可以得到通知.轮询是完成此任务的方法.

It looks like the answer is no. There appears to be no way to be notified when an EC2 instance transition has completed. Polling is the way to accomplish this.

这篇关于等待AWS EC2实例停止或开始完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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