EC2 Question and Answers
EC2 Question and Answers
Accelerated Computing Instances G4dn xlarge 16gb 0.579 USD per hour 4vCPU
Storage Optimized Instances H1 i3 xlarge 30.5 gb 0.354 USD per hour 4 vCPU
OnDemand – Allows you to pay a fixed rate by hour (or by the second) with no commitment
Reserved – Provide you with a capacity reservation and offer a significant discount on the hourly charge
Spot – Enable you to bid whatever price you want for instance capacity, providing for even greater
Dedicated Hosts – Physical EC2 server is dedicated for your use. Dedicated Hosts can help you reduce
(failed system status checks , incorrect networking or startup configuration, exhaused memory,
corrupted file system, incompatible kernel - reason for 2/2 check fail)
select the instance and go to action - monitor and troubleshoot - get system log
Snapshot is a point in time backup of specific volume while AMI is is backup of the entire EC2 instance
that might have multiple attached volumes, exactly like virtual machines.
7. how you will mount EBS volums permanently in your lenux machine?
file -s /dev/xvdf -- to make sure is there any file system (data: no file system)
cat /etc/fstab
vi /etc/fstab
8. is it possible to migreat a volume from one account to anther? is yes how? if not why?
Copy the AWS Account ID and paste it into your favorite notepad, we will need it later.
create snapshot from root volume of ec2 instance.and then select the snapshot choose action and click
modify permission.
choose private,and then give to AWS account number for which account need to copy the volume.After
that checking target aws account console ,go snapshot in filter private one, it will be shown.
In the upper-right corner of the page, choose Account Attributes, EBS encryption.
Choose Manage.
For Default encryption key, choose a symmetric customer managed encryption key.
- detach unencryed volume from the EC2 instance and attach the encryped volume
11. if you lost your Ec2 key pair how you will recover your EC2 Machine?
2. If you create the private key in the Amazon EC2 console, then retrieve the public key for the key pair.
6. Copy the following script into the Edit user data dialog box:
MIME-Version: 1.0
--//
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
#cloud-config
cloud_final_modules:
- [users-groups, once]
users:
- name: username
ssh-authorized-keys:
- PublicKeypair
Replace username with your user name, such as ec2-user. You can enter the default user name, or enter
a custom user name, if one was previously set up for the instance. For a list of default user names, see
General prerequisites for connecting to your instance.
Replace PublicKeypair with the public key retrieved in step 2. Be sure to enter the entire public key,
starting with ssh-rsa.
7. Choose Save.
9. After the cloud-init phase is complete, validate that the public key was replaced.
Important: Because the script contains a key pair, remove the script from the User Data field.
12. Delete all the text in the Edit user data dialog box, and then choose Save.
Method 2
copy the Authorized keys from the new Ec2 instance to the mounted(old) volume
unmount from the New Ec2 instance and attach and mount to the old Ec2 instance
Systemctl httpd
Lifecycle Manager - selectt policy type - target resources (volume) - policy status to be Enabled
KMS key description : Default master key that protects my EBS volumes when no other keys is defined
14. how you will migrate a volume from one zone to another?