简体   繁体   English

如何以编程方式创建 ami 实例?

[英]How to create ami instance programmatically?

lately I am doing some POC's in amazon elastic cloud.最近我在亚马逊弹性云中做一些 POC。 I created a sample instance and I uploaded my sample web application and finally saw my hello world jsp.我创建了一个示例实例并上传了我的示例 Web 应用程序,最后看到了我的 hello world jsp。

Now I am trying to create one more instance and want to send data from my first instance to second instance.现在我正在尝试再创建一个实例,并希望将数据从我的第一个实例发送到第二个实例。 I know that this can be achieved through zookeeper.我知道这可以通过zookeeper来实现。 But I want to create my second instance programmatically and not through the management console.但我想以编程方式而不是通过管理控制台创建我的第二个实例。

How to achieve this?如何实现这一目标? I am thinking that this has something to do with the amazon s3 where we bundle our ami.我认为这与我们捆绑 ami 的亚马逊 s3 有关。 But not sure about it.但不确定。 Can anyone give me guidelines?谁能给我指导?

This is a link to the Amazon documentation for creating an AMI. 这是用于创建 AMI 的 Amazon 文档的链接 Amazon provide a set of command line tools so you should be able to call these from your script. Amazon 提供了一组命令行工具,因此您应该能够从脚本中调用这些工具

you may also find these 3rd party scripts useful for creating a bootable EBS from a running instance.您可能还会发现这些 3rd 方脚本对于从正在运行的实例创建可引导 EBS 很有用。

Or it may be more useful to invoke the AWS EC2 APIs more directly from your application.或者,更直接地从您的应用程序调用AWS EC2 API可能更有用。

You could also use Packer from Hashicorp to automate the creation of amazon AMIs.您还可以使用 Hashicorp 的Packer来自动创建亚马逊 AMI。 Check out the link below to find out how to create an AMI using packer :查看下面的链接,了解如何使用 packer 创建 AMI:

https://www.packer.io/intro/getting-started/build-image/ https://www.packer.io/intro/getting-started/build-image/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM