是否可以用不同的 AMI 替换 EC2 实例上的 AMI? [英] Is it possible to replace the AMI on an EC2 instance with a different AMI?

查看:27
本文介绍了是否可以用不同的 AMI 替换 EC2 实例上的 AMI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个带有 LAMP 堆栈和 Laravel 的 EC2 AMI 实例.我需要更新我的 LAMP 堆栈版本以及 Laravel 版本.我正在考虑运行一个新的 EC2 实例作为我的更新过程的沙箱,并安装一个全新的 LAMP 堆栈 + Laravel,然后对我的 Laravel 代码库进行更改,以使我的所有代码都能使用新的更新.然后我可以从这个新实例导出 AMI 并用新的 AMI 替换我已经运行的 EC2 的 AMI.这样我就不需要要求我的客户和他们的客户更改 IP 地址等任何内容.我不得不提一下,我对所有这些都不熟悉,所以请教我最好的方法.谢谢!

I'm running an EC2 AMI instance with LAMP stack and Laravel. I need to update my LAMP stack version as well as the Laravel version. I was thinking of running a new EC2 instance as my sandbox for the update process and install a brand new LAMP stack + Laravel and then make changes on my Laravel code base to make all my code work with the new updates. Can I then export the AMI from this new instance and replace my already running EC2's AMI with the new one. This way I don't need to ask my client and their clients to change anything such as IP address. I have to mention that I'm new to all these so please educate me on the the best approach to this. Thank you!

推荐答案

答案是您无法替换现有 EC2 实例的 AMI.但是,您可以使用基本相同的新卷替换根卷.新的根卷可以来自另一个 EC2 实例.我只是重复了这些步骤来验证这确实可以做到.

The answer is that you cannot replace the AMI for an existing EC2 instance. However, you can replace the root volume with a new volume which is basically the same thing. That new root volume can come from another EC2 instance. I just repeated the steps to verify that this actually can be done.

  • 创建第二个系统根卷的快照.
  • 将快照复制到与第一个系统相同的可用区.
  • 从快照创建一个新卷.
  • 分离旧的根卷.如果出现问题,请先标记.
  • 附加新的根卷.
  • 启动实例并验证所有内容.

[更新]

我只是再次重复了这些步骤,但这次我在快照复制期间启用了加密.这是现在加密 EC2 实例根卷的另一种方法.另一种方法是在启用加密的同时复制现有 AMI,但第二种方法是创建新实例.

I just repeated these steps again, but this time I enabled encryption during the snapshot copy. This is now another method of encrypting the root volume of an EC2 instance. The other method is to copy an existing AMI while enabling encryption, but the second method is for creating new instances.

这篇关于是否可以用不同的 AMI 替换 EC2 实例上的 AMI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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