EC2 - 创建AMI - 无法连接到新的实例 [英] EC2 - Create AMI - Cannot connect to new instance

查看:250
本文介绍了EC2 - 创建AMI - 无法连接到新的实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到困难想从EBS卷启动AMI。我基本上是试图启动Linux(I386)根据AMI,我已经配置就是我想要的另一个实例。我跟许多导游在过去的一周。到目前为止,我能够创建定制的私人AMI,但我无法启动新的实例后,连接到它。我怀疑,我创建了AMI是想念配置以某种方式(也许文件没有得到完全复制)。

I am experiencing difficulty trying to launch a AMI from an EBS volume. I am basically trying to launch another instance of a Linux (i386) based AMI that I have already configured the way I want. I have followed many guides for the past week. So far, I am able to create the custom private AMI but I am unable to connect to it after launching the new instance. I suspect that the AMI I have created is miss-configured in some way (maybe files didnt get fully copied over).

总之这里的基本步骤我经历来尝试创建AMI:

Anyhow here are the basic steps I'm going through to try to create the AMI:

EC2创建卷-K PK-xxxxxx.pem -C   CERT-xxxxxx.pem --size 10   --availability区美东 - 1A

ec2-create-volume -K pk-xxxxxx.pem -C cert-xxxxxx.pem --size 10 --availability-zone us-east-1a

EC2-附加卷-K PK-xxxxxx.pem -C   CERT-xxxxxx.pem卷-XXXXXX --instance   XXXXXX --device的/ dev / SDH

ec2-attach-volume -K pk-xxxxxx.pem -C cert-xxxxxx.pem vol-xxxxxx --instance xxxxxx --device /dev/sdh

是|的mkfs -t EXT3的/ dev / SDH       MKDIR / MNT / ebsimage

yes | mkfs -t ext3 /dev/sdh mkdir/mnt/ebsimage

回声的/ dev / SDH到/ mnt / ebsimage EXT3   默认值,noatime的0 0>> / etc / fstab文件

echo '/dev/sdh /mnt/ebsimage ext3 defaults,noatime 0 0' >> /etc/fstab

挂载到/ mnt / ebsimage

mount /mnt/ebsimage

使用umount / MNT / ebsimage

umount /mnt/ebsimage

EC2-分离批量-K PK-xxxxxx.pem -C   CERT-xxxxxx.pem卷-XXXXXX --instance   XXXXXX

ec2-detach-volume -K pk-xxxxxx.pem -C cert-xxxxxx.pem vol-xxxxxx --instance xxxxxx

EC2创建快照-K PK-xxxxxx.pem   -C CERT-xxxxxx.pem卷-XXXXXX

ec2-create-snapshot -K pk-xxxxxx.pem -C cert-xxxxxx.pem vol-xxxxxx

ec2reg -K PK-xxxxxx.pem -C   CERT-xxxxxx.pem -s单元XXXXX -a I386   -d -n --kernel AKI-XXXXX --ramdisk ARI-XXXXXX

ec2reg -K pk-xxxxxx.pem -C cert-xxxxxx.pem -s snap-xxxxx -a i386 -d -n --kernel aki-xxxxx --ramdisk ari-xxxxxx

我是pretty的肯定无论是我的Mount命令坏了或者我周围ec2reg命令搞砸了。有什么建议?

I'm pretty sure either my commands around mount are messed up or my commands around ec2reg are messed up. Any suggestions?

我也尝试更换

是|的mkfs -t EXT3的/ dev / SDH

yes | mkfs -t ext3 /dev/sdh

的mkdir到/ mnt / ebsimage

mkdir/mnt/ebsimage

回声的/ dev / SDH   到/ mnt / ebsimage ext3的默认值,noatime的0   0'>> / etc / fstab文件

echo '/dev/sdh /mnt/ebsimage ext3 defaults,noatime 0 0' >> /etc/fstab

挂载到/ mnt / ebsimage

mount /mnt/ebsimage

与设计使用rsync,并添加一些其他细节,但再次AMI的新实例启动不能连接到一个脚本。下面是脚本的副本。

with a script designed to use rsync and add some other details but again the new instance of the ami launched cannot be connected to. Here is a copy of the script.

#!/bin/sh
vol=/dev/sdh
ebsmnt=/mnt/ebsimage
mkdir ${ebsmnt}
mkfs.ext3 -F ${vol}
sync
echo "mount $vol $ebsmnt"
mount $vol $ebsmnt
mkdir ${ebsmnt}/mnt
mkdir ${ebsmnt}/proc
mkdir ${ebsmnt}/sys
devdir=${ebsmnt}/dev
echo "mkdir ${devdir}"
mkdir ${devdir}
mknod ${devdir}/null    c 1 3
mknod ${devdir}/zero    c 1 5
mknod ${devdir}/tty     c 5 0
mknod ${devdir}/console c 5 1
ln -s null ${devdir}/X0R
rsync -rlpgoD -t -r -S -l -vh \
--exclude /sys --exclude /proc \
--exclude /dev \
--exclude /media --exclude /mnt \
--exclude /sys --exclude /ebs --exclude /mnt \
-x /* ${ebsmnt}
df -h

由于我有相同的结果作为第一个例子,我不知道如果我接近解决这一问题,或渐行渐远。任何帮助将是AP preciated。

Because I have the same results as the first example, I'm not sure if I'm closer to solving this issue or further away. Any help would be appreciated.

推荐答案

我不知道你想运行的分配,但如果要运行Debian的,有负责管理整个引导过程包括急性心肌梗死的脚本创建(EBS引导)。

I don't know which distribution you are trying to run, but if you want to run debian, there is a script which manages the entire bootstrapping process including ami creation (EBS boot).

您可以在我的github上的帐户发现: https://github.com/andsens/ec2debian-build-ami

You can find it on my github account: https://github.com/andsens/ec2debian-build-ami

剧本已经经过全面测试,并允许您包括其他脚本,以自定义您的AMI。如果要修改脚本本身,只是叉吧,至少你再有一个基地从,在那里你知道一切正常工作。

The script has been thoroughly tested and allows you to include other scripts in order to customize your ami. If you want to modify the script itself, just fork it, at least you then have a base to work from, where you know everything works.

我不建议你列出虽然这个过程中,它似乎很凌乱。

I would not recommend the process you outlined though, it seems quite 'messy'.

这篇关于EC2 - 创建AMI - 无法连接到新的实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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