Understand Shared AMI Usage In Amazon EC2
Introduction
A shared AMI is an Amazon
Machine Image created by a developer for others to utilize. One of the simplest
methods to begin with Amazon EC2 is to utilize a shared AMI that includes the
necessary components and then incorporate your own content. Additionally, you
have the option to develop your own AMIs and share them with others.
When utilizing a shared
AMI, you do so at your own risk. Amazon cannot guarantee the integrity or
security of AMIs that other Amazon EC2 users have shared. Consequently, you
should approach shared AMIs in the same way you would with any external code
you might think about deploying in your own data center, and conduct the
necessary due diligence. It is advisable to obtain an AMI from a reliable
source, like a verified provider.
Verified provider
In the Amazon EC2
console, public AMIs owned by Amazon or recognized Amazon partners are labeled
as Verified provider. You can also utilize the describe-images AWS CLI command
to find public AMIs that originate from a verified provider. Public images that
are owned by Amazon or a verified partner have a distinctive owner alias,
either amazon, aws-backup-vault, or aws-marketplace. These values will
be displayed as ImageOwnerAlias in the CLI output. Other users are not
permitted to assign aliases to their AMIs. This feature allows you to easily
locate AMIs from Amazon or verified partners.
To become a verified
provider, you must register as a seller on the AWS Marketplace. Once
registered, you can list your AMI on the AWS Marketplace.
Find Shared AMIs To Use For
Amazon EC2 Instances
You have the option to
utilize either the Amazon EC2 console or the command line to locate both public
and private shared AMIs for your Amazon EC2 instances. AMIs are specific to a
Region. When searching for a shared AMI (whether public or private), you need
to conduct the search from the same Region where it was shared. If you want to
make an AMI accessible in another Region, you need to copy the AMI to that
Region first and then share it.
Prepare To Use Shared
AMIs For Linux
Before utilizing a shared
AMI for Linux, ensure you perform the following steps to verify that there are
no existing credentials that might grant unauthorized access to your instance
by external parties and no configured remote logging that could send sensitive
information to third parties. Refer to the documentation for the Linux
distribution associated with the AMI for guidelines on enhancing the system's
security.
To avoid accidentally
losing access to your instance, it is advisable to start two SSH sessions and
keep the additional session open until you've deleted any unfamiliar
credentials and verified that you can still access your instance via SSH.
- Identify and disable any unauthorized public SSH keys. The only key in the file should be the key you used to launch the AMI.
- Disable password-based authentication for the root user. Open the sshd_config file and edit the PermitRootLogin line. Alternatively, you can disable the ability to log into the instance as the root user. Restart the sshd service.
- Check whether there are any other users that are able to log in to your instance. Users with superuser privileges are particularly dangerous. Remove or lock the password of any unknown accounts.
- Check for open ports that you aren't using and running network services listening for incoming connections.
- To prevent preconfigured remote logging, you should delete the existing configuration file and restart the rsyslog service.
- Verify that all cron jobs are legitimate.
If you discover a public
AMI that you feel presents a security risk, contact the AWS security team.
Conclusion
Many steps regarding the usage of shared AMI in Amazon EC2 are discussed.
Comments
Post a Comment