Grub/i386-PC/normal.mod' not found in AWS EC2 machine? - amazon-web-services

I have tried below steps,but still stuck in the same :
we've had the same issue where the EC2 machine system check failed. When looking at the snapshot of the machine, it showed "/grub/i386-pc/normal.mod" not found.
So, we detached the EBS volume, create a new EC2 machine with the same base AMI and attached the faulty machine's EBS volume to the Recovery EC2 Instance.
After this we mount the faulty EBS to recovery instance to "/home/ubuntu/mount_point" directory. But we are unable to find /grub or /boot directory in this mount_point folder.
Thanks.Any help is appreciated.

Related

Storing data on EBS vs EC2

I'm having trouble understanding whether my data on an AWS EC2 instance is on the EC2 itself or on the attached EBS. I used scp to copy some files from my computer to the folder /home/ec2-user. At this point is the data already on the EBS volume or just on EC2? The EC2 lists /dev/sda1 as a block device. Does this mean the files are only on EBS when moved to that directory? Also, the directory /dev exists but sda1 does not.

unable to create folder on /mnt via chef recipe

I am using the following chef command to create a folder on /mnt
directory '/mnt/node/deploy' do
owner 'ubuntu'
group 'ubuntu'
mode '0755'
recursive true
action :create
end
This is a part of a recipe which is invoked via packer to create an AWS AMI. ubuntu is the user that I use to deploy my code to a provisioned machine.
When I launch an EC2 instance using the AMI, this folder is not created on the machine. What could be the problem? I see no errors when the AMI is created.
Update -1
These are the logs. I tried using root.
`amazon-ebs: * directory[/mnt/node/deploy] action create`
`amazon-ebs: - create new directory /mnt/node/deploy`
`amazon-ebs: - change mode from '' to '0755'`
`amazon-ebs: - change owner from '' to 'root'`
`amazon-ebs: - change group from '' to 'root'`
I see that EC2 is mounting ephemeral storage on /mnt.
I want to create these folders on the ephemeral storage.
I unmounted /mnt, but did not see the folders there.
Packer runs Chef before creating the image. So, if I understand you correctly:
Chef creates the directory on an instance ephemeral storage.
Packer creates the AMI.
You start the AMI and the directory does not exist in the ephemeral storage.
AFAIK that's an expected behavior. The directory is created in a partition that is ephemeral and this kind of partitions are not expected to endure.
Summarizing, when you create an AWS AMI image, it does not include the ephemeral storage. Only the EBS volumes. Ephemeral partitions are always empty at startup. If you want to retain that directory, it must be in a EBS partition.
If you still want to use the /mnt directory, you can avoid mounting the ephemeral storage with the ami_block_device_mappings option:
"ami_block_device_mappings": [
{
"device_name": "/dev/sdb",
"no_device": true
}
],
And the same for the launch_block_device_mappings
Another solution could be to run your Chef cookbook again in the newly created instance.
amazon-ebs is the name of the packer builder:
amazon-ebs - Create EBS-backed AMIs by launching a source AMI and
re-packaging it into a new AMI after provisioning. If in doubt, use
this builder, which is the easiest to get started with.
It runs the whole machine as EBS-backed so it can convert the EBS volume into an AMI later.
This is not related to Chef.

Can we mount a AMI snapshot to a local machine?

I want to determine a snapshot associated with a given AMI-ID, then mount a copy of that snapshot onto the local machine(and not AWS Instance).
I am using boto to get the snapshot-id from the AMI-ID
image = conn.get_image(ami)
snapshot_id = image.block_device_mapping.current_value.snapshot_id
Is it possible to mount a snapshot to a local machine and not a EC2-instance ?
For EBS backed AMIs there isn't a way to accomplish this that I'm aware of.
With an Instance Store-Backed AMI and quite a bit of effort, yes. See this blog post.
Other helpful resources:
Eight-Bit Guru's Answer
S3 vs. EBS backed instances
Selecting between EBS and Instance Store-Backed AMI

how can I clearly differentiate between AWS EC2 AMI, snapshot and instance?

I'm super confused about what AMI, snapshot, and instance are. also, the aws documentation did not clear anything to me. I still do not understand what they are and the difference between them
Could somebody clarify?
Instance : is the virtual machine ( computing resource ) ; named EC2 in AWS terminology .
Snapshot : is a backup of volume (virtual hard-disk , named EBS) that can be associated with the instance (with the virtual machine ).
AMI : is a special snapshot , it is a snapshot for the root volume ( where the OS is installed). That's why you can boot new instance (machine virtual) from that AMI since it is a snapshot of root volume ( includes OS) .
OS : Operating System .
An Amazon Machine Image (AMI) is a repository containing the information required for you to launch a virtual machine on AWS including the operating system, OS instantiation instructions, etc.
An instance is a running instance of a virtual machine, that is created from the AMI. To create a new instance you select an AMI (e.g. Ubuntu, CentOS, Windows etc.) and instantiate it - i.e. you ask the AWS infrastructure to read the information contained in the AMI and use that to create a running virtual machine, which is the instance.
A snapshot is just that - a copy of the EBS disks that the AWS infrastructure saves on request to a file.
HTH.

Effect of EC2 config change on EBS-backed Wordpress?

I am deploying Wordpress site using LAMP AMI on EBS-backed EC2. Wordpress database will be stored in EBS.
Amazon keeps on updating base configuration of EC2 for better performance & security.
If I have to upgrade my EC2 then my EBS will get deleted.
How can I ensure that my EC2 gets updated without affecting my EBS?
EBS Snapshot is not of any help as new EC2 already has a EBS attached.
Do I have to always migrate my Wordpress site using backup & do this upgradtion?
Amazon EC2 instances use EBS volumes as their disk volumes. They are populated from an Amazon Machine Image (AMI) when the instance is launched.
When AWS releases updated AMIs, any new instance launched from the AMI will contain the updated disk content. However, existing EC2 instances will not be changed (since they have a copy of the AMI at the time that the instance was launched).
You can also change the Instance Type of an EC2 instance, which gives it different hardware (CPU, Memory). This can be done by stopping the instance, changing the type and starting it again. This will not affect the contents of EBS volumes.
If you wish to keep your instance "current", simply run sudo yum update (Linux) or run the Windows Update utility to update your operating system and associated utilities rather than launching a whole new instance.

Resources