id
stringlengths 14
16
| text
stringlengths 1
2.43k
| source
stringlengths 99
229
|
---|---|---|
2eed8bff68fe-2 | **Instance 2**
| Metadata | Value |
| --- | --- |
| instance\-id | i\-0598c7d356eba48d7 |
| ami\-launch\-index | 1 |
| public\-hostname | ec2\-67\-202\-51\-224\.compute\-1\.amazonaws\.com |
| public\-ipv4 | 67\.202\.51\.224 |
| local\-hostname | ip\-10\-251\-50\-36\.ec2\.internal |
| local\-ipv4 | 10\.251\.50\.36 |
**Instance 3**
| Metadata | Value |
| --- | --- |
| instance\-id | i\-0ee992212549ce0e7 |
| ami\-launch\-index | 2 |
| public\-hostname | ec2\-67\-202\-51\-225\.compute\-1\.amazonaws\.com |
| public\-ipv4 | 67\.202\.51\.225 |
| local\-hostname | ip\-10\-251\-50\-37\.ec2\.internal |
| local\-ipv4 | 10\.251\.50\.37 |
**Instance 4**
| Metadata | Value | | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/AMI-launch-index-examples.md |
2eed8bff68fe-3 | | local\-ipv4 | 10\.251\.50\.37 |
**Instance 4**
| Metadata | Value |
| --- | --- |
| instance\-id | i\-1234567890abcdef0 |
| ami\-launch\-index | 3 |
| public\-hostname | ec2\-67\-202\-51\-226\.compute\-1\.amazonaws\.com |
| public\-ipv4 | 67\.202\.51\.226 |
| local\-hostname | ip\-10\-251\-50\-38\.ec2\.internal |
| local\-ipv4 | 10\.251\.50\.38 |
Alice can use the `ami-launch-index` value to determine which portion of the user data is applicable to a particular instance\.
1. She connects to one of the instances, and retrieves the `ami-launch-index` for that instance to ensure it is one of the replicas:
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/AMI-launch-index-examples.md |
bd3061337cef-0 | ```
[ec2-user ~]$ TOKEN=`curl -X PUT "http://169.254.169.254/latest/meta-data/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` \
&& curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/ami-launch-index
2
```
For the following steps, the IMDSv2 requests use the stored token from the preceding IMDSv2 command, assuming the token has not expired\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/AMI-launch-index-examples.md |
0d01637610eb-0 | ```
[ec2-user ~]$ curl http://169.254.169.254/latest/meta-data/ami-launch-index
2
```
------
1. She saves the `ami-launch-index` as a variable\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/AMI-launch-index-examples.md |
129dbbc93359-0 | ```
[ec2-user ~]$ ami_launch_index=`curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/ami-launch-index`
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/AMI-launch-index-examples.md |
20b20b7b1835-0 | ```
[ec2-user ~]$ ami_launch_index=`curl http://169.254.169.254/latest/meta-data/ami-launch-index`
```
------
1. She saves the user data as a variable\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/AMI-launch-index-examples.md |
e25c8d58e64d-0 | ```
[ec2-user ~]$ user_data=`curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/user-data`
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/AMI-launch-index-examples.md |
635f7fc84890-0 | ```
[ec2-user ~]$ user_data=`curl http://169.254.169.254/latest/user-data`
```
------
1. Finally, Alice uses the cut command to extract the portion of the user data that is applicable to that instance\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/AMI-launch-index-examples.md |
bd4f909fac4e-0 | ```
[ec2-user ~]$ echo $user_data | cut -d"|" -f"$ami_launch_index"replicate-every=5min
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/AMI-launch-index-examples.md |
1749d603e711-0 | ```
[ec2-user ~]$ echo $user_data | cut -d"|" -f"$ami_launch_index"
replicate-every=5min
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/AMI-launch-index-examples.md |
5305967f578d-0 | Your application might need to determine whether it is running on an EC2 instance\.
For information about identifying Windows instances, see [Identify EC2 Windows Instances](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/identify_ec2_instances.html) in the *Amazon EC2 User Guide for Windows Instances*\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/identify_ec2_instances.md |
31fad5087963-0 | For a definitive and cryptographically verified method of identifying an EC2 instance, check the instance identity document, including its signature\. These documents are available on every EC2 instance at the local, non\-routable address `http://169.254.169.254/latest/dynamic/instance-identity/`\. For more information, see [Instance identity documents](instance-identity-documents.md)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/identify_ec2_instances.md |
ba042c9e298d-0 | You can get the system UUID and look for the presence of the characters "ec2" or "EC2" in the beginning octet of the UUID\. This method to determine whether a system is an EC2 instance is quick but potentially inaccurate because there is a small chance that a system that is not an EC2 instance could have a UUID that starts with these characters\. Furthermore, for EC2 instances that are not using Amazon Linux, the distribution's implementation of SMBIOS might represent the UUID in little\-endian format, therefore the "EC2" characters do not appear at the beginning of the UUID\.
**Example : Get the UUID from the hypervisor**
If `/sys/hypervisor/uuid` exists, you can use the following command:
```
[ec2-user ~]$ cat /sys/hypervisor/uuid
```
In the following example output, the UUID starts with "ec2", which indicates that the system is probably an EC2 instance\.
```
ec2e1916-9099-7caf-fd21-012345abcdef
```
**Example : Get the UUID from DMI \(HVM instances only\)**
On HVM instances only, you can use the Desktop Management Interface \(DMI\)\.
You can use the `dmidecode` tool to return the UUID\. On Amazon Linux, use the following command to install the `dmidecode` tool if it's not already installed on your instance: | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/identify_ec2_instances.md |
ba042c9e298d-1 | ```
[ec2-user ~]$ sudo yum install dmidecode -y
```
Then run the following command:
```
[ec2-user ~]$ sudo dmidecode --string system-uuid
```
Alternatively, use the following command:
```
[ec2-user ~]$ sudo cat /sys/devices/virtual/dmi/id/product_uuid
```
In the following example output, the UUID starts with "EC2", which indicates that the system is probably an EC2 instance\.
```
EC2E1916-9099-7CAF-FD21-01234ABCDEF
```
In the following example output, the UUID is represented in little\-endian format\.
```
45E12AEC-DCD1-B213-94ED-01234ABCDEF
```
On Nitro instances, the following command can be used:
```
[ec2-user ~]$ cat /sys/devices/virtual/dmi/id/board_asset_tag
```
This returns the instance ID, which is unique to EC2 instances:
```
i-0af01c0123456789a
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/identify_ec2_instances.md |
825976bba7cd-0 | Amazon EC2 Instance Connect provides a simple and secure way to connect to your instances using Secure Shell \(SSH\)\. With EC2 Instance Connect, you use AWS Identity and Access Management \(IAM\) policies and principals to control SSH access to your instances, removing the need to share and manage SSH keys\. All connection requests using EC2 Instance Connect are [logged to AWS CloudTrail so that you can audit connection requests](monitor-with-cloudtrail.md#ec2-instance-connect-cloudtrail)\.
You can use Instance Connect to connect to your Linux instances using a browser\-based client, the Amazon EC2 Instance Connect CLI, or the SSH client of your choice\.
When you connect to an instance using EC2 Instance Connect, the Instance Connect API pushes a one\-time\-use SSH public key to the [instance metadata](ec2-instance-metadata.md) where it remains for 60 seconds\. An IAM policy attached to your IAM user authorizes your IAM user to push the public key to the instance metadata\. The SSH daemon uses `AuthorizedKeysCommand` and `AuthorizedKeysCommandUser`, which are configured when Instance Connect is installed, to look up the public key from the instance metadata for authentication, and connects you to the instance\.
**Tip**
If you are connecting to a Linux instance from a local computer running Windows, see the following documentation instead:
+ [Connecting to your Linux instance from Windows using PuTTY](putty.md)
+ [Connecting to your Linux instance using SSH](AccessingInstancesLinux.md) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/Connect-using-EC2-Instance-Connect.md |
825976bba7cd-1 | + [Connecting to your Linux instance using SSH](AccessingInstancesLinux.md)
+ [Connecting to your Linux instance from Windows using Windows Subsystem for Linux](WSL.md)
**Topics**
+ [Set up EC2 Instance Connect](ec2-instance-connect-set-up.md)
+ [Connect using EC2 Instance Connect](ec2-instance-connect-methods.md)
+ [Uninstall EC2 Instance Connect](ec2-instance-connect-uninstall.md) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/Connect-using-EC2-Instance-Connect.md |
564686f747b2-0 | This topic explains how to verify the instance identity document using the RSA\-2048 signature and the AWS RSA\-2048 public certificate\.
**Important**
To validate the instance identity document using the RSA\-2048 signature, you must request the AWS RSA\-2048 public certificate from [AWS Support](https://console.aws.amazon.com/support/home#/)\.
**To verify the instance identity document using the RSA\-2048 signature and the AWS RSA\-2048 public certificate**
1. Connect to the instance\.
1. Retrieve the RSA\-2048 signature from the instance metadata and add it to a file named `rsa2048`\.
1. Add the `-----BEGIN PKCS7-----` header to the `rsa2048` file\.
```
$ echo "-----BEGIN PKCS7-----" > rsa2048
```
1. Retrieve the RSA\-2048 signature from the instance metadata and append it to the `rsa2048` file\. Use one of the following commands depending on the IMDS version used by the instance\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/verify-rsa2048.md |
c565dc67e6f4-0 | ```
$ TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` \
&& curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/dynamic/instance-identity/rsa2048 >> rsa2048
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/verify-rsa2048.md |
eeeb2b6b6440-0 | ```
$ curl -s http://169.254.169.254/latest/dynamic/instance-identity/rsa2048 >> rsa2048
```
------
1. Append the `-----END PKCS7-----` footer to a new line in the `rsa2048` file\.
```
$ echo "" >> rsa2048
$ echo "-----END PKCS7-----" >> rsa2048
```
1. Add the contents of the instance identity document from the instance metadata to a file named `document`\. Use one of the following commands depending on the IMDS version used by the instance\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/verify-rsa2048.md |
f4193dbf7cd3-0 | ```
$ TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` \
&& curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/dynamic/instance-identity/document > document
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/verify-rsa2048.md |
9a18afe48b77-0 | ```
$ curl -s http://169.254.169.254/latest/dynamic/instance-identity/document > document
```
------
1. Add the AWS RSA\-2048 public certificate to a file named `certificate`\.
1. Create the `certificate` file\.
```
$ touch certificate
```
1. Open the `certificate` file using your preferred text editor and add the contents of the AWS RSA\-2048 public certificate that you received from AWS Support\.
1. Save and close the file\.
1. Use the **OpenSSL smime** command to verify the signature\. Include the `-verify` option to indicate that the signature needs to be verified, and the `-noverify` option to indicate that the certificate does not need to be verified\.
```
$ openssl smime -verify -in rsa2048 -inform PEM -content document -certfile certificate -noverify
```
If the signature is valid, the `Verification successful` message appears\. If the signature cannot be verified, contact AWS Support\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/verify-rsa2048.md |
3b1df43fa9c7-0 | The size of an Amazon EBS volume is constrained by the physics and arithmetic of block data storage, as well as by the implementation decisions of operating system \(OS\) and file system designers\. AWS imposes additional limits on volume size to safeguard the reliability of its services\.
The following sections describe the most important factors that limit the usable size of an EBS volume and offer recommendations for configuring your EBS volumes\.
**Topics**
+ [Storage capacity](#ebs-storage-capacity)
+ [Service limitations](#aws_limits)
+ [Partitioning schemes](#partitioning)
+ [Data block sizes](#block_size) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/volume_constraints.md |
ed817b1846c5-0 | The following table summarizes the theoretical and implemented storage capacities for the most commonly used file systems on Amazon EBS, assuming a 4,096 byte block size\.
| Partitioning scheme | Max addressable blocks | Theoretical max size \(blocks × block size\) | Ext4 implemented max size\* | XFS implemented max size\*\* | NTFS implemented max size | Max supported by EBS |
| --- | --- | --- | --- | --- | --- | --- |
| MBR | 232 | 2 TiB | 2 TiB | 2 TiB | 2 TiB | 2 TiB |
| GPT | 264 | 64 ZiB | 1 EiB =10242 TiB \(50 TiB certified on RHEL7\) | 500 TiB \(certified on RHEL7\) | 256 TiB | 16 TiB |
\* [https://ext4.wiki.kernel.org/index.php/Ext4_Howto](https://ext4.wiki.kernel.org/index.php/Ext4_Howto) and [https://access.redhat.com/solutions/1532](https://access.redhat.com/solutions/1532)
\*\* [https://access.redhat.com/solutions/1532](https://access.redhat.com/solutions/1532) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/volume_constraints.md |
789fdfb78ae0-0 | Amazon EBS abstracts the massively distributed storage of a data center into virtual hard disk drives\. To an operating system installed on an EC2 instance, an attached EBS volume appears to be a physical hard disk drive containing 512\-byte disk sectors\. The OS manages the allocation of data blocks \(or clusters\) onto those virtual sectors through its storage management utilities\. The allocation is in conformity with a volume partitioning scheme, such as master boot record \(MBR\) or GUID partition table \(GPT\), and within the capabilities of the installed file system \(ext4, NTFS, and so on\)\.
EBS is not aware of the data contained in its virtual disk sectors; it only ensures the integrity of the sectors\. This means that AWS actions and OS actions are independent of each other\. When you are selecting a volume size, be aware of the capabilities and limits of both, as in the following cases:
+ EBS currently supports a maximum volume size of 16 TiB\. This means that you can create an EBS volume as large as 16 TiB, but whether the OS recognizes all of that capacity depends on its own design characteristics and on how the volume is partitioned\.
+ Linux boot volumes may use either the MBR or GPT partitioning scheme\. MBR supports boot volumes up to 2047 GiB \(2 TiB \- 1 GiB\)\. GPT with GRUB 2 supports boot volumes 2 TiB or larger\. If your Linux AMI uses MBR, your boot volume is limited to 2047 GiB, but your non\-boot volumes do not have this limit\. For more information, see [Making an Amazon EBS volume available for use on Linux](ebs-using-volumes.md)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/volume_constraints.md |
28ae6a89216e-0 | Among other impacts, the partitioning scheme determines how many logical data blocks can be uniquely addressed in a single volume\. For more information, see [Data block sizes](#block_size)\. The common partitioning schemes in use are *master boot record* \(MBR\) and *GUID partition table* \(GPT\)\. The important differences between these schemes can be summarized as follows\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/volume_constraints.md |
464fe1f03e7c-0 | MBR uses a 32\-bit data structure to store block addresses\. This means that each data block is mapped with one of 232 possible integers\. The maximum addressable size of a volume is given by:
```
(232 - 1) × Block size = Number of addressable blocks
```
The block size for MBR volumes is conventionally limited to 512 bytes\. Therefore:
```
(232 - 1) × 512 bytes = 2 TiB - 512 bytes
```
Engineering workarounds to increase this 2\-TiB limit for MBR volumes have not met with widespread industry adoption\. Consequently, Linux and Windows never detect an MBR volume as being larger than 2 TiB even if AWS shows its size to be larger\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/volume_constraints.md |
b7cf4eb8016a-0 | GPT uses a 64\-bit data structure to store block addresses\. This means that each data block is mapped with one of 264 possible integers\. The maximum addressable size of a volume is given by:
```
(264 - 1) × Block size = Number of addressable blocks
```
The block size for GPT volumes is commonly 4,096 bytes\. Therefore:
```
(264 - 1) × 4,096 bytes
= 264 x 4,096 bytes - 1 x 4,096 bytes
= 264 x 212 bytes - 4,096 bytes
= 270 x 26 bytes - 4,096 bytes
= 64 ZiB - 4,096 bytes
```
Real\-world computer systems don't support anything close to this theoretical maximum\. Implemented file\-system size is currently limited to 50 TiB for ext4 and 256 TiB for NTFS—both of which exceed the 16\-TiB limit imposed by AWS\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/volume_constraints.md |
8dd31988302d-0 | Data storage on a modern hard drive is managed through *logical block addressing*, an abstraction layer that allows the operating system to read and write data in logical blocks without knowing much about the underlying hardware\. The OS relies on the storage device to map the blocks to its physical sectors\. EBS advertises 512\-byte sectors to the operating system, which reads and writes data to disk using data blocks that are a multiple of the sector size\.
The industry default size for logical data blocks is currently 4,096 bytes \(4 KiB\)\. Because certain workloads benefit from a smaller or larger block size, file systems support non\-default block sizes that can be specified during formatting\. Scenarios in which non\-default block sizes should be used are outside the scope of this topic, but the choice of block size has consequences for the storage capacity of the volume\. The following table shows storage capacity as a function of block size:
| Block size | Max volume size |
| --- | --- |
| 4 KiB \(default\) | 16 TiB |
| 8 KiB | 32 TiB |
| 16 KiB | 64 TiB |
| 32 KiB | 128 TiB |
| 64 KiB \(maximum\) | 256 TiB |
The EBS\-imposed limit on volume size \(16 TiB\) is currently equal to the maximum size enabled by 4\-KiB data blocks\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/volume_constraints.md |
b4f4c3226030-0 | All Reserved Instances provide you with a discount compared to On\-Demand pricing\. With Reserved Instances, you pay for the entire term regardless of actual use\. You can choose to pay for your Reserved Instance upfront, partially upfront, or monthly, depending on the [payment option](ec2-reserved-instances.md#ri-payment-options) specified for the Reserved Instance\.
When Reserved Instances expire, you are charged On\-Demand rates for EC2 instance usage\. You can queue a Reserved Instance for purchase up to three years in advance\. This can help you ensure that you have uninterrupted coverage\. For more information, see [Queuing your purchase](ri-market-concepts-buying.md#ri-queued-purchase)\.
The AWS Free Tier is available for new AWS accounts\. If you are using the AWS Free Tier to run Amazon EC2 instances, and you purchase a Reserved Instance, you are charged under standard pricing guidelines\. For information, see [AWS Free Tier](https://aws.amazon.com/free)\.
**Topics**
+ [Usage billing](#hourly-billing)
+ [Viewing your bill](#ri-market-buyer-billing)
+ [Reserved Instances and consolidated billing](#concepts-reserved-instances-billing)
+ [Reserved Instance discount pricing tiers](#reserved-instances-discounts) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/concepts-reserved-instances-application.md |
988cdecb6948-0 | Reserved Instances are billed for every clock\-hour during the term that you select, regardless of whether an instance is running\. Each clock\-hour starts on the hour \(zero minutes and zero seconds past the hour\) of a standard 24\-hour clock\. For example, 1:00:00 to 1:59:59 is one clock\-hour\. For more information about instance states, see [Instance lifecycle](ec2-instance-lifecycle.md)\.
A Reserved Instance billing benefit can be applied to a running instance on a per\-second basis\. Per\-second billing is available for instances using an open\-source Linux distribution, such as Amazon Linux and Ubuntu\. Per\-hour billing is used for commercial Linux distributions, such as Red Hat Enterprise Linux and SUSE Linux Enterprise Server\.
A Reserved Instance billing benefit can apply to a maximum of 3600 seconds \(one hour\) of instance usage per clock\-hour\. You can run multiple instances concurrently, but can only receive the benefit of the Reserved Instance discount for a total of 3600 seconds per clock\-hour; instance usage that exceeds 3600 seconds in a clock\-hour is billed at the On\-Demand rate\.
For example, if you purchase one `m4.xlarge` Reserved Instance and run four `m4.xlarge` instances concurrently for one hour, one instance is charged at one hour of Reserved Instance usage and the other three instances are charged at three hours of On\-Demand usage\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/concepts-reserved-instances-application.md |
988cdecb6948-1 | However, if you purchase one `m4.xlarge` Reserved Instance and run four `m4.xlarge` instances for 15 minutes \(900 seconds\) each within the same hour, the total running time for the instances is one hour, which results in one hour of Reserved Instance usage and 0 hours of On\-Demand usage\.
![\[Image NOT FOUND\]](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/images/ri-per-second-billing.png)
If multiple eligible instances are running concurrently, the Reserved Instance billing benefit is applied to all the instances at the same time up to a maximum of 3600 seconds in a clock\-hour; thereafter, On\-Demand rates apply\.
![\[Image NOT FOUND\]](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/images/ri-per-second-billing-concurrent.png)
**Cost Explorer** on the [Billing and Cost Management](https://console.aws.amazon.com/billing) console enables you to analyze the savings against running On\-Demand Instances\. The [Reserved Instances FAQ](https://aws.amazon.com/ec2/faqs/#reserved-instances) includes an example of a list value calculation\.
If you close your AWS account, On\-Demand billing for your resources stops\. However, if you have any Reserved Instances in your account, you continue to receive a bill for these until they expire\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/concepts-reserved-instances-application.md |
03b1d4a33bbc-0 | You can find out about the charges and fees to your account by viewing the [AWS Billing and Cost Management](https://console.aws.amazon.com/billing) console\.
+ The **Dashboard** displays a spend summary for your account\.
+ On the **Bills** page, under **Details** expand the **Elastic Compute Cloud** section and the Region to get billing information about your Reserved Instances\.
You can view the charges online, or you can download a CSV file\.
You can also track your Reserved Instance utilization using the AWS Cost and Usage Report\. For more information, see [Reserved Instances ](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/billing-reports-costusage-ri.html) under Cost and Usage Report in the *AWS Billing and Cost Management User Guide*\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/concepts-reserved-instances-application.md |
cf6c85c93583-0 | The pricing benefits of Reserved Instances are shared when the purchasing account is part of a set of accounts billed under one consolidated billing payer account\. The instance usage across all member accounts is aggregated in the payer account every month\. This is typically useful for companies in which there are different functional teams or groups; then, the normal Reserved Instance logic is applied to calculate the bill\. For more information, see [Consolidated Billing and AWS Organizations](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_from-consolidatedbilling.html) in the *AWS Organizations User Guide*\.
If you close the account that purchased the Reserved Instance, the payer account will continue being charged for the Reserved Instance until either the Reserved Instance expires or the closed account is permanently deleted\. The closed account is permanently deleted after 90 days\. After it is deleted, the member accounts will stop benefitting from the Reserved Instance billing discount\. For more information about closing an account, see [Closing an AWS Account](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_accounts_close.html) in the *AWS Organizations User Guide*\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/concepts-reserved-instances-application.md |
7d46f7a0c79c-0 | If your account qualifies for a discount pricing tier, it automatically receives discounts on upfront and instance usage fees for Reserved Instance purchases that you make within that tier level from that point on\. To qualify for a discount, the list value of your Reserved Instances in the Region must be $500,000 USD or more\.
The following rules apply:
+ Pricing tiers and related discounts apply only to purchases of Amazon EC2 Standard Reserved Instances\.
+ Pricing tiers do not apply to Reserved Instances for Windows with SQL Server Standard, SQL Server Web, and SQL Server Enterprise\.
+ Pricing tiers do not apply to Reserved Instances for Linux with SQL Server Standard, SQL Server Web, and SQL Server Enterprise\.
+ Pricing tier discounts only apply to purchases made from AWS\. They do not apply to purchases of third\-party Reserved Instances\.
+ Discount pricing tiers are currently not applicable to Convertible Reserved Instance purchases\.
**Topics**
+ [Calculating Reserved Instance pricing discounts](#pricing-discounts)
+ [Buying with a discount tier](#buying-discount-tier)
+ [Crossing pricing tiers](#crossing-pricing-tiers)
+ [Consolidated billing for pricing tiers](#consolidating-billing) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/concepts-reserved-instances-application.md |
a5170727ffec-0 | You can determine the pricing tier for your account by calculating the list value for all of your Reserved Instances in a Region\. Multiply the hourly recurring price for each reservation by the total number of hours for the term and add the undiscounted upfront price \(also known as the fixed price\) at the time of purchase\. Because the list value is based on undiscounted \(public\) pricing, it is not affected if you qualify for a volume discount or if the price drops after you buy your Reserved Instances\.
```
List value = fixed price + (undiscounted recurring hourly price * hours in term)
```
For example, for a 1\-year Partial Upfront `t2.small` Reserved Instance, assume the upfront price is $60\.00 and the hourly rate is $0\.007\. This provides a list value of $121\.32\.
```
121.32 = 60.00 + (0.007 * 8760)
```
**To view the fixed price values for Reserved Instances using the Amazon EC2 console**
1. Open the Amazon EC2 console at [https://console\.aws\.amazon\.com/ec2/](https://console.aws.amazon.com/ec2/)\.
1. In the navigation pane, choose **Reserved Instances**\.
1. Display the **Upfront Price** column by choosing **Show/Hide Columns** \(the gear\-shaped icon\) in the top right corner\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/concepts-reserved-instances-application.md |
a5170727ffec-1 | **To view the fixed price values for Reserved Instances using the command line**
+ [describe\-reserved\-instances](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-reserved-instances.html) \(AWS CLI\)
+ [Get\-EC2ReservedInstance](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2ReservedInstance.html) \(AWS Tools for Windows PowerShell\)
+ [DescribeReservedInstances](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeReservedInstances.html) \(Amazon EC2 API\) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/concepts-reserved-instances-application.md |
ede833fcf98d-0 | When you buy Reserved Instances, Amazon EC2 automatically applies any discounts to the part of your purchase that falls within a discount pricing tier\. You don't need to do anything differently, and you can buy Reserved Instances using any of the Amazon EC2 tools\. For more information, see [Buying Reserved Instances](ri-market-concepts-buying.md)\.
After the list value of your active Reserved Instances in a Region crosses into a discount pricing tier, any future purchase of Reserved Instances in that Region are charged at a discounted rate\. If a single purchase of Reserved Instances in a Region takes you over the threshold of a discount tier, then the portion of the purchase that is above the price threshold is charged at the discounted rate\. For more information about the temporary Reserved Instance IDs that are created during the purchase process, see [Crossing pricing tiers](#crossing-pricing-tiers)\.
If your list value falls below the price point for that discount pricing tier—for example, if some of your Reserved Instances expire—future purchases of Reserved Instances in the Region are not discounted\. However, you continue to get the discount applied against any Reserved Instances that were originally purchased within the discount pricing tier\.
When you buy Reserved Instances, one of four possible scenarios occurs:
+ **No discount**—Your purchase within a Region is still below the discount threshold\.
+ **Partial discount**—Your purchase within a Region crosses the threshold of the first discount tier\. No discount is applied to one or more reservations and the discounted rate is applied to the remaining reservations\.
+ **Full discount**—Your entire purchase within a Region falls within one discount tier and is discounted appropriately\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/concepts-reserved-instances-application.md |
ede833fcf98d-1 | + **Full discount**—Your entire purchase within a Region falls within one discount tier and is discounted appropriately\.
+ **Two discount rates**—Your purchase within a Region crosses from a lower discount tier to a higher discount tier\. You are charged two different rates: one or more reservations at the lower discounted rate, and the remaining reservations at the higher discounted rate\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/concepts-reserved-instances-application.md |
f3b91d6fb1e5-0 | If your purchase crosses into a discounted pricing tier, you see multiple entries for that purchase: one for that part of the purchase charged at the regular price, and another for that part of the purchase charged at the applicable discounted rate\.
The Reserved Instance service generates several Reserved Instance IDs because your purchase crossed from an undiscounted tier, or from one discounted tier to another\. There is an ID for each set of reservations in a tier\. Consequently, the ID returned by your purchase CLI command or API action is different from the actual ID of the new Reserved Instances\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/concepts-reserved-instances-application.md |
b4ba9c4162a7-0 | A consolidated billing account aggregates the list value of member accounts within a Region\. When the list value of all active Reserved Instances for the consolidated billing account reaches a discount pricing tier, any Reserved Instances purchased after this point by any member of the consolidated billing account are charged at the discounted rate \(as long as the list value for that consolidated account stays above the discount pricing tier threshold\)\. For more information, see [Reserved Instances | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/concepts-reserved-instances-application.md |
b4ba9c4162a7-1 | threshold\)\. For more information, see [Reserved Instances and consolidated billing](#concepts-reserved-instances-billing)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/concepts-reserved-instances-application.md |
bea95331c0cd-0 | To purchase a Reserved Instance, search for *Reserved Instance offerings* from AWS and third\-party sellers, adjusting your search parameters until you find the exact match that you're looking for\.
When you search for Reserved Instances to buy, you receive a quote on the cost of the returned offerings\. When you proceed with the purchase, AWS automatically places a limit price on the purchase price\. The total cost of your Reserved Instances won't exceed the amount that you were quoted\.
If the price rises or changes for any reason, the purchase is not completed\. If, at the time of purchase, there are offerings similar to your choice but at a lower price, AWS sells you the offerings at the lower price\.
Before you confirm your purchase, review the details of the Reserved Instance that you plan to buy, and make sure that all the parameters are accurate\. After you purchase a Reserved Instance \(either from a third\-party seller in the Reserved Instance Marketplace or from AWS\), you cannot cancel your purchase\.
**Note**
To purchase and modify Reserved Instances, ensure that your IAM user account has the appropriate permissions, such as the ability to describe Availability Zones\. For information, see [Example Policies for Working With the AWS CLI or an AWS SDK](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ExamplePolicies_EC2.html#iam-example-reservedinstances) and [Example Policies for Working in the Amazon EC2 Console](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-policies-ec2-console.html#ex-reservedinstances)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
bea95331c0cd-1 | **Topics**
+ [Choosing a platform](#ri-choosing-platform)
+ [Queuing your purchase](#ri-queued-purchase)
+ [Buying Standard Reserved Instances](#ri-buying-standard)
+ [Buying Convertible Reserved Instances](#ri-buying-convertible)
+ [Viewing your Reserved Instances](#view-reserved-instances)
+ [Canceling a queued purchase](#cancel-queued-purchase)
+ [Renewing a Reserved Instance](#renew-ri)
+ [Using your Reserved Instances](#reserved-instances-process) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
b632cf78c5c2-0 | Amazon EC2 supports the following Linux platforms for Reserved Instances:
+ Linux/UNIX
+ Linux with SQL Server Standard
+ Linux with SQL Server Web
+ Linux with SQL Server Enterprise
+ SUSE Linux
+ Red Hat Enterprise Linux
When you purchase a Reserved Instance, you must choose an offering for a *platform* that represents the operating system for your instance\.
+ For SUSE Linux and RHEL distributions, you must choose offerings for those specific platforms, i\.e\., for the **SUSE Linux** or **Red Hat Enterprise Linux** platforms\.
+ For all other Linux distributions \(including Ubuntu\), choose an offering for the **Linux/UNIX** platform\.
+ If you bring your existing RHEL subscription, you must choose an offering for the **Linux/UNIX** platform, not an offering for the **Red Hat Enterprise Linux** platform\.
**Important**
If you purchase a Reserved Instance to apply to an On\-Demand Instance that was launched from an AMI with a billing product code, make sure that the Reserved Instance has the matching billing product code\. If you purchase a Reserved Instance without the matching billing product code, the Reserved Instance will not be applied to the On\-Demand Instance\. For more information about how to obtain the AMI billing code, see [Obtaining billing information](ami-billing-info.md)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
b632cf78c5c2-1 | If you plan to purchase a Reserved Instance to apply to an On\-Demand Instance that was launched from an AWS Marketplace AMI, first check the `PlatformDetails` field of the AMI\. The `PlatformDetails` field indicates which Reserved Instance to purchase\. The platform details of the AMI must match the platform of the Reserved Instance, otherwise the Reserved Instance will not be applied to the On\-Demand Instance\. For information about how to view the platform details of the AMI, see [Obtaining billing information](ami-billing-info.md)\.
For information about the supported platforms for Windows, see [Choosing a platform](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ri-market-concepts-buying.html#ri-choosing-platform) in the *Amazon EC2 User Guide for Windows Instances*\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
aa3f8e025677-0 | By default, when you purchase a Reserved Instance, it is executed immediately\. Alternatively, you can queue your purchases for a future date and time\. For example, you can queue a purchase for around the time that an existing Reserved Instance expires\. This can help you ensure that you have uninterrupted coverage\.
You can queue purchases for regional Reserved Instances, but not zonal Reserved Instances or Reserved Instances from other sellers\. You can queue a purchase up to three years in advance\. On the scheduled date and time, the purchase is executed using the default payment method\. After the payment is successful, the billing benefit is applied\.
You can view your queued purchases in the Amazon EC2 console\. The status of a queued purchase is **queued**\. You can cancel a queued purchase any time before its scheduled time\. For details, see [Canceling a queued purchase](#cancel-queued-purchase)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
3c3eab8d5903-0 | You can buy Standard Reserved Instances in a specific Availability Zone and get a capacity reservation\. Alternatively, you can forego the capacity reservation and purchase a regional Standard Reserved Instance\.
**To buy Standard Reserved Instances using the console**
1. Open the Amazon EC2 console at [https://console\.aws\.amazon\.com/ec2/](https://console.aws.amazon.com/ec2/)\.
1. In the navigation pane, choose **Reserved Instances**, and then choose **Purchase Reserved Instances**\.
1. For **Offering Class**, choose **Standard** to display Standard Reserved Instances\.
1. To purchase a capacity reservation, choose **Only show offerings that reserve capacity** in the top\-right corner of the purchase screen\. To purchase a regional Reserved Instance, leave the check box unselected\.
1. Select other configurations as needed and choose **Search**\.
To purchase a Standard Reserved Instance from the Reserved Instance Marketplace, look for **3rd Party** in the **Seller** column in the search results\. The **Term** column displays non\-standard terms\.
1. Select the Reserved Instances to purchase, enter the quantity, and choose **Add to Cart**\.
1. To see a summary of the Reserved Instances that you selected, choose **View Cart**\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
3c3eab8d5903-1 | 1. To see a summary of the Reserved Instances that you selected, choose **View Cart**\.
1. If **Order On** is **Now**, the purchase is completed immediately\. To queue a purchase, choose **Now** and select a date\. You can select a different date for each eligible offering in the cart\. The purchase is queued until 00:00, in the time zone of your browser, on the selected date\.
1. To complete the order, choose **Order**\.
If, at the time of placing the order, there are offerings similar to your choice but with a lower price, AWS sells you the offerings at the lower price\.
1. The status of your order is listed in the **State** column\. When your order is complete, the **State** value changes from `payment-pending` to `active`\. When the Reserved Instance is `active`, it is ready to use\.
**Note**
If the status goes to `retired`, AWS may not have received your payment\.
**To buy a Standard Reserved Instance using the AWS CLI** | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
3c3eab8d5903-2 | **To buy a Standard Reserved Instance using the AWS CLI**
1. Find available Reserved Instances using the [describe\-reserved\-instances\-offerings](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-reserved-instances-offerings.html) command\. Specify `standard` for the `--offering-class` parameter to return only Standard Reserved Instances\. You can apply additional parameters to narrow your results\. For example, if you want to purchase a regional `t2.large` Reserved Instance with a default tenancy for `Linux/UNIX` for a 1\-year term only:
```
aws ec2 describe-reserved-instances-offerings \
--instance-type t2.large \
--offering-class standard \
--product-description "Linux/UNIX" \
--instance-tenancy default \
--filters Name=duration,Values=31536000 Name=scope,Values=Region
```
To find Reserved Instances on the Reserved Instance Marketplace only, use the `marketplace` filter and do not specify a duration in the request, as the term may be shorter than a 1– or 3\-year term\.
```
aws ec2 describe-reserved-instances-offerings \
--instance-type t2.large \
--offering-class standard \
--product-description "Linux/UNIX" \
--instance-tenancy default \
--filters Name=marketplace,Values=true | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
3c3eab8d5903-3 | --product-description "Linux/UNIX" \
--instance-tenancy default \
--filters Name=marketplace,Values=true
```
When you find a Reserved Instance that meets your needs, take note of the offering ID\. For example:
```
"ReservedInstancesOfferingId": "bec624df-a8cc-4aad-a72f-4f8abc34caf2"
```
1. Use the [purchase\-reserved\-instances\-offering](https://docs.aws.amazon.com/cli/latest/reference/ec2/purchase-reserved-instances-offering.html) command to buy your Reserved Instance\. You must specify the Reserved Instance offering ID you obtained the previous step and you must specify the number of instances for the reservation\.
```
aws ec2 purchase-reserved-instances-offering \
--reserved-instances-offering-id bec624df-a8cc-4aad-a72f-4f8abc34caf2 \
--instance-count 1
```
By default, the purchase is completed immediately\. Alternatively, to queue the purchase, add the following parameter to the previous call\.
```
--purchase-time "2020-12-01T00:00:00Z"
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
3c3eab8d5903-4 | ```
--purchase-time "2020-12-01T00:00:00Z"
```
1. Use the [describe\-reserved\-instances](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-reserved-instances.html) command to get the status of your Reserved Instance\.
```
aws ec2 describe-reserved-instances
```
Alternatively, use the following AWS Tools for Windows PowerShell commands:
+ [Get\-EC2ReservedInstancesOffering](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2ReservedInstancesOffering.html)
+ [New\-EC2ReservedInstance](https://docs.aws.amazon.com/powershell/latest/reference/items/New-EC2ReservedInstance.html)
+ [Get\-EC2ReservedInstance](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2ReservedInstance.html)
After the purchase is complete, if you already have a running instance that matches the specifications of the Reserved Instance, the billing benefit is immediately applied\. You do not have to restart your instances\. If you do not have a suitable running instance, launch an instance and ensure that you match the same criteria that you specified for your Reserved Instance\. For more information, see [Using your Reserved Instances](#reserved-instances-process)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
3c3eab8d5903-5 | For examples of how Reserved Instances are applied to your running instances, see [How Reserved Instances are applied](apply_ri.md)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
81f17e3e6e65-0 | You can buy Convertible Reserved Instances in a specific Availability Zone and get a capacity reservation\. Alternatively, you can forego the capacity reservation and purchase a regional Convertible Reserved Instance\.
**To buy Convertible Reserved Instances using the console**
1. Open the Amazon EC2 console at [https://console\.aws\.amazon\.com/ec2/](https://console.aws.amazon.com/ec2/)\.
1. In the navigation pane, choose **Reserved Instances**, and then choose **Purchase Reserved Instances**\.
1. For **Offering Class**, choose **Convertible** to display Convertible Reserved Instances\.
1. To purchase a capacity reservation, choose **Only show offerings that reserve capacity** in the top\-right corner of the purchase screen\. To purchase a regional Reserved Instance, leave the check box unselected\.
1. Select other configurations as needed and choose **Search**\.
1. Select the Convertible Reserved Instances to purchase, enter the quantity, and choose **Add to Cart**\.
1. To see a summary of your selection, choose **View Cart**\.
1. If **Order On** is **Now**, the purchase is completed immediately\. To queue a purchase, choose **Now** and select a date\. You can select a different date for each eligible offering in the cart\. The purchase is queued until 00:00, in the time zone of your browser, on the selected date\.
1. To complete the order, choose **Order**\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
81f17e3e6e65-1 | 1. To complete the order, choose **Order**\.
If, at the time of placing the order, there are offerings similar to your choice but with a lower price, AWS sells you the offerings at the lower price\.
1. The status of your order is listed in the **State** column\. When your order is complete, the **State** value changes from `payment-pending` to `active`\. When the Reserved Instance is `active`, it is ready to use\.
**Note**
If the status goes to `retired`, AWS may not have received your payment\.
**To buy a Convertible Reserved Instance using the AWS CLI**
1. Find available Reserved Instances using the [describe\-reserved\-instances\-offerings](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-reserved-instances-offerings.html) command\. Specify `convertible` for the `--offering-class` parameter to return only Convertible Reserved Instances\. You can apply additional parameters to narrow your results; for example, if you want to purchase a regional `t2.large` Reserved Instance with a default tenancy for `Linux/UNIX`:
```
aws ec2 describe-reserved-instances-offerings \
--instance-type t2.large \
--offering-class convertible \
--product-description "Linux/UNIX" \
--instance-tenancy default \
--filters Name=scope,Values=Region
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
81f17e3e6e65-2 | --instance-tenancy default \
--filters Name=scope,Values=Region
```
When you find a Reserved Instance that meets your needs, take note of the offering ID\. For example:
```
"ReservedInstancesOfferingId": "bec624df-a8cc-4aad-a72f-4f8abc34caf2"
```
1. Use the [purchase\-reserved\-instances\-offering](https://docs.aws.amazon.com/cli/latest/reference/ec2/purchase-reserved-instances-offering.html) command to buy your Reserved Instance\. You must specify the Reserved Instance offering ID you obtained the previous step and you must specify the number of instances for the reservation\.
```
aws ec2 purchase-reserved-instances-offering \
--reserved-instances-offering-id bec624df-a8cc-4aad-a72f-4f8abc34caf2 \
--instance-count 1
```
By default, the purchase is completed immediately\. Alternatively, to queue the purchase, add the following parameter to the previous call\.
```
--purchase-time "2020-12-01T00:00:00Z"
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
81f17e3e6e65-3 | ```
--purchase-time "2020-12-01T00:00:00Z"
```
1. Use the [describe\-reserved\-instances](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-reserved-instances.html) command to get the status of your Reserved Instance\.
```
aws ec2 describe-reserved-instances
```
Alternatively, use the following AWS Tools for Windows PowerShell commands:
+ [Get\-EC2ReservedInstancesOffering](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2ReservedInstancesOffering.html)
+ [New\-EC2ReservedInstance](https://docs.aws.amazon.com/powershell/latest/reference/items/New-EC2ReservedInstance.html)
+ [Get\-EC2ReservedInstance](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2ReservedInstance.html)
If you already have a running instance that matches the specifications of the Reserved Instance, the billing benefit is immediately applied\. You do not have to restart your instances\. If you do not have a suitable running instance, launch an instance and ensure that you match the same criteria that you specified for your Reserved Instance\. For more information, see [Using your Reserved Instances](#reserved-instances-process)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
81f17e3e6e65-4 | For examples of how Reserved Instances are applied to your running instances, see [How Reserved Instances are applied](apply_ri.md)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
5398a8b69bd3-0 | You can view the Reserved Instances you've purchased using the Amazon EC2 console, or a command line tool\.
**To view your Reserved Instances in the console**
1. Open the Amazon EC2 console at [https://console\.aws\.amazon\.com/ec2/](https://console.aws.amazon.com/ec2/)\.
1. In the navigation pane, choose **Reserved Instances**\.
1. Your active and retired Reserved Instances are listed\. The **State** column displays the state\.
1. If you are a seller in the Reserved Instance Marketplace the **My Listings** tab displays the status of a reservation that's listed in the [Reserved Instance Marketplace](ri-market-general.md)\. For more information, see [Reserved Instance listing states](ri-market-general.md#ri-listing-states)\.
**To view your Reserved Instances using the command line**
+ [describe\-reserved\-instances](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-reserved-instances.html) \(AWS CLI\)
+ [Get\-EC2ReservedInstance](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2ReservedInstance.html) \(Tools for Windows PowerShell\) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
36ba2bfcfe03-0 | You can queue a purchase up to three years in advance\. You can cancel a queued purchase any time before its scheduled time\.
**To cancel a queued purchase**
1. Open the Amazon EC2 console at [https://console\.aws\.amazon\.com/ec2/](https://console.aws.amazon.com/ec2/)\.
1. In the navigation pane, choose **Reserved Instances**\.
1. Select one or more Reserved Instances\.
1. Choose **Actions**, **Delete Queued Reserved Instances**\.
1. When prompted for confirmation, choose **Yes, Delete**\.
**To cancel a queued purchase using the command line**
+ [delete\-queued\-reserved\-instances](https://docs.aws.amazon.com/cli/latest/reference/ec2/delete-queued-reserved-instances.html) \(AWS CLI\)
+ [Remove\-EC2QueuedReservedInstance](https://docs.aws.amazon.com/powershell/latest/reference/items/Remove-EC2QueuedReservedInstance.html) \(Tools for Windows PowerShell\) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
e09937520d6d-0 | You can renew a Reserved Instance before it is scheduled to expire\. Renewing a Reserved Instance queues the purchase of a Reserved Instance with the same configuration until the current Reserved Instance expires\.
**To renew an Reserved Instance using a queued purchase**
1. Open the Amazon EC2 console at [https://console\.aws\.amazon\.com/ec2/](https://console.aws.amazon.com/ec2/)\.
1. In the navigation pane, choose **Reserved Instances**\.
1. Select one or more Reserved Instances\.
1. Choose **Actions**, **Renew Reserved Instances**\.
1. To complete the order, choose **Order**\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
6fe1a801082e-0 | Reserved Instances are automatically applied to running On\-Demand Instances provided that the specifications match\. If you have no running On\-Demand Instances that match the specifications of your Reserved Instance, the Reserved Instance is unused until you launch an instance with the required specifications\.
If you're launching an instance to take advantage of the billing benefit of a Reserved Instance, ensure that you specify the following information during launch:
+ Platform: You must choose an Amazon Machine Image \(AMI\) that matches the platform \(product description\) of your Reserved Instance\. For example, if you specified `Linux/UNIX`, you can launch an instance from an Amazon Linux AMI or an Ubuntu AMI\.
+ Instance type: Specify the same instance type as your Reserved Instance; for example, `t2.large`\.
+ Availability Zone: If you purchased a Reserved Instance for a specific Availability Zone, you must launch the instance into the same Availability Zone\. If you purchased a regional Reserved Instance, you can launch your instance into any Availability Zone\.
+ Tenancy: The tenancy of your instance must match the tenancy of the Reserved Instance; for example, `dedicated` or `shared`\. For more information, see [Dedicated Instances](dedicated-instance.md)\.
For more information, see [Launching an instance using the Launch Instance Wizard](launching-instance.md)\. For examples of how Reserved Instances are applied to your running instances, see [How Reserved Instances are applied](apply_ri.md)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
6fe1a801082e-1 | You can use Amazon EC2 Auto Scaling or other AWS services to launch the On\-Demand Instances that use your Reserved Instance benefits\. For more information, see the [Amazon EC2 Auto Scaling User Guide](https://docs.aws.amazon.com/autoscaling/latest/userguide/WhatIsAutoScaling.html)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ri-market-concepts-buying.md |
47191577e9d7-0 | A key pair, consisting of a private key and a public key, is a set of security credentials that you use to prove your identity when connecting to an instance\. Amazon EC2 stores the public key, and you store the private key\. You use the private key, instead of a password, to securely access your instances\. Anyone who possesses your private keys can connect to your instances, so it's important that you store your private keys in a secure place\.
When you launch an instance, you are [prompted for a key pair](launching-instance.md#step-7-review-instance-launch)\. If you plan to connect to the instance using SSH, you must specify a key pair\. You can choose an existing key pair or create a new one\. When your instance boots for the first time, the content of the public key that you specified at launch is placed on your Linux instance in an entry within `~/.ssh/authorized_keys`\. When you connect to your Linux instance using SSH, to log in you must specify the private key that corresponds to the public key content\. For more information about connecting to your instance, see [Connect to your Linux instance](AccessingInstances.md)\. For more information about key pairs and Windows instances, see [Amazon EC2 key pairs and Windows instances](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-key-pairs.html) in the *Amazon EC2 User Guide for Windows Instances* | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
47191577e9d7-1 | Because Amazon EC2 doesn't keep a copy of your private key, there is no way to recover a private key if you lose it\. However, there can still be a way to connect to instances for which you've lost the private key\. For more information, see [Connecting to your Linux instance if you lose your private key](replacing-lost-key-pair.md)\.
The keys that Amazon EC2 uses are 2048\-bit SSH\-2 RSA keys\. You can have up to 5,000 key pairs per Region\.
**Topics**
+ [Creating or importing a key pair](#prepare-key-pair)
+ [Tagging a key pair](#tag-key-pair)
+ [Retrieving the public key for your key pair](#retrieving-the-public-key)
+ [Retrieving the public key for your key pair through instance metadata](#retrieving-the-public-key-instance)
+ [Locating the public key on an instance](#locate-public-key-on-instance)
+ [Identifying the key pair that was specified at launch](#identify-key-pair-specified-at-launch)
+ [\(Optional\) Verifying your key pair's fingerprint](#verify-key-pair-fingerprints)
+ [Adding or replacing a key pair for your instance](#replacing-key-pair)
+ [Connecting to your Linux instance if you lose your private key](replacing-lost-key-pair.md) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
47191577e9d7-2 | + [Connecting to your Linux instance if you lose your private key](replacing-lost-key-pair.md)
+ [Deleting your key pair](#delete-key-pair) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
79c42dac1f35-0 | You can use Amazon EC2 to create a new key pair, or you can import an existing key pair\.
**Topics**
+ [Option 1: Create a key pair using Amazon EC2](#having-ec2-create-your-key-pair)
+ [Option 2: Import your own public key to Amazon EC2](#how-to-generate-your-own-key-and-import-it-to-aws) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
9294014a991e-0 | You can create a key pair using one of the following methods\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
80c65fb61e69-0 | **To create your key pair**
1. Open the Amazon EC2 console at [https://console\.aws\.amazon\.com/ec2/](https://console.aws.amazon.com/ec2/)\.
1. In the navigation pane, under **NETWORK & SECURITY**, choose **Key Pairs**\.
1. Choose **Create key pair**\.
1. For **Name**, enter a descriptive name for the key pair\. Amazon EC2 associates the public key with the name that you specify as the key name\. A key name can include up to 255 ASCII characters\. It can’t include leading or trailing spaces\.
1. For **File format**, choose the format in which to save the private key\. To save the private key in a format that can be used with OpenSSH, choose **pem**\. To save the private key in a format that can be used with PuTTY, choose **ppk**\.
1. Choose **Create key pair**\.
1. The private key file is automatically downloaded by your browser\. The base file name is the name you specified as the name of your key pair, and the file name extension is determined by the file format you chose\. Save the private key file in a safe place\.
**Important**
This is the only chance for you to save the private key file\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
80c65fb61e69-1 | **Important**
This is the only chance for you to save the private key file\.
1. If you will use an SSH client on a macOS or Linux computer to connect to your Linux instance, use the following command to set the permissions of your private key file so that only you can read it\.
```
chmod 400 my-key-pair.pem
```
If you do not set these permissions, then you cannot connect to your instance using this key pair\. For more information, see [Error: Unprotected private key file](TroubleshootingInstancesConnecting.md#troubleshoot-unprotected-key)\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
617173fea4f6-0 | **To create your key pair**
1. Open the Amazon EC2 console at [https://console\.aws\.amazon\.com/ec2/](https://console.aws.amazon.com/ec2/)\.
1. In the navigation pane, under **NETWORK & SECURITY**, choose **Key Pairs**\.
1. Choose **Create Key Pair**\.
1. For **Key pair name**, enter a descriptive name for the key pair, and then choose **Create**\. A key name can include up to 255 ASCII characters\. It can’t include leading or trailing spaces\.
1. The private key file is automatically downloaded by your browser\. The base file name is the name you specified as the name of your key pair, and the file name extension is `.pem`\. Save the private key file in a safe place\.
**Important**
This is the only chance for you to save the private key file\.
1. If you will use an SSH client on a macOS or Linux computer to connect to your Linux instance, use the following command to set the permissions of your private key file so that only you can read it\.
```
chmod 400 my-key-pair.pem
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
617173fea4f6-1 | ```
chmod 400 my-key-pair.pem
```
If you do not set these permissions, then you cannot connect to your instance using this key pair\. For more information, see [Error: Unprotected private key file](TroubleshootingInstancesConnecting.md#troubleshoot-unprotected-key)\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
7c13b145134a-0 | **To create your key pair**
1. Use the [create\-key\-pair](https://docs.aws.amazon.com/cli/latest/reference/ec2/create-key-pair.html) AWS CLI command as follows to generate the key and save it to a `.pem` file\.
```
aws ec2 create-key-pair --key-name my-key-pair --query 'KeyMaterial' --output text > my-key-pair.pem
```
1. If you will use an SSH client on a macOS or Linux computer to connect to your Linux instance, use the following command to set the permissions of your private key file so that only you can read it\.
```
chmod 400 my-key-pair.pem
```
If you do not set these permissions, then you cannot connect to your instance using this key pair\. For more information, see [Error: Unprotected private key file](TroubleshootingInstancesConnecting.md#troubleshoot-unprotected-key)\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
6effb6ef242f-0 | **To create your key pair**
Use the [New\-EC2KeyPair](https://docs.aws.amazon.com/powershell/latest/reference/items/New-EC2KeyPair.html) AWS Tools for Windows PowerShell command as follows to generate the key and save it to a `.pem` file\.
```
PS C:\> (New-EC2KeyPair -KeyName "my-key-pair").KeyMaterial | Out-File -Encoding ascii -FilePath C:\path\my-key-pair.pem
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
e9e7fc5ce6db-0 | Instead of using Amazon EC2 to create your key pair, you can create an RSA key pair using a third\-party tool and then import the public key to Amazon EC2\. For example, you can use ssh\-keygen \(a tool provided with the standard OpenSSH installation\) to create a key pair\. Alternatively, Java, Ruby, Python, and many other programming languages provide standard libraries that you can use to create an RSA key pair\.
**Requirements**
+
The following formats are supported:
+ OpenSSH public key format \(the format in `~/.ssh/authorized_keys`\)\. If you connect using SSH while using the EC2 Instance Connect API, the SSH2 format is also supported\.
+ Base64 encoded DER format
+ SSH public key file format as specified in [RFC4716](http://tools.ietf.org/html/rfc4716)
+ SSH private key file format must be PEM \(for example, use `ssh-keygen -m PEM` to convert the OpenSSH key into the PEM format\)
+ Create an RSA key\. Amazon EC2 does not accept DSA keys\.
+ The supported lengths are 1024, 2048, and 4096\. If you connect using SSH while using the EC2 Instance Connect API, the supported lengths are 2048 and 4096\.
**To create a key pair using a third\-party tool**
1. Generate a key pair with a third\-party tool of your choice\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
e9e7fc5ce6db-1 | **To create a key pair using a third\-party tool**
1. Generate a key pair with a third\-party tool of your choice\.
1. Save the public key to a local file\. For example, `~/.ssh/my-key-pair.pub` \(Linux\) or `C:\keys\my-key-pair.pub` \(Windows\)\. The file name extension for this file is not important\.
1. Save the private key to a different local file that has the `.pem` extension\. For example, `~/.ssh/my-key-pair.pem` \(Linux\) or `C:\keys\my-key-pair.pem` \(Windows\)\. Save the private key file in a safe place\. You'll need to provide the name of your key pair when you launch an instance and the corresponding private key each time you connect to the instance\.
After you have created the key pair, use one of the following methods to import your key pair to Amazon EC2\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
f1dc0dc69661-0 | **To import the public key**
1. Open the Amazon EC2 console at [https://console\.aws\.amazon\.com/ec2/](https://console.aws.amazon.com/ec2/)\.
1. In the navigation pane, choose **Key Pairs**\.
1. Choose **Import key pair**\.
1. For **Name**, enter a descriptive name for the key pair\. The name can include up to 255 ASCII characters\. It can’t include leading or trailing spaces\.
1. Either choose **Browse** to navigate to and select your public key, or paste the contents of your public key into the **Public key contents** field\.
1. Choose **Import key pair**\.
1. Verify that the key pair you imported appears in the list of key pairs\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
d80c75a36196-0 | **To import the public key**
1. Open the Amazon EC2 console at [https://console\.aws\.amazon\.com/ec2/](https://console.aws.amazon.com/ec2/)\.
1. In the navigation pane, under **NETWORK & SECURITY**, choose **Key Pairs**\.
1. Choose **Import Key Pair**\.
1. In the **Import Key Pair** dialog box, choose **Browse**, and select the public key file that you saved previously\. Enter a name for the key pair in the **Key pair name** field, and choose **Import**\. The name can include up to 255 ASCII characters\. It can’t include leading or trailing spaces\.
1. Verify that the key pair you imported appears in the list of key pairs\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
8f5436e6306b-0 | **To import the public key**
Use the [import\-key\-pair](https://docs.aws.amazon.com/cli/latest/reference/ec2/import-key-pair.html) AWS CLI command\.
**To verify that the key pair was imported successfully**
Use the [describe\-key\-pairs](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-key-pairs.html) AWS CLI command\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
9c19af37aea4-0 | **To import the public key**
Use the [Import\-EC2KeyPair](https://docs.aws.amazon.com/powershell/latest/reference/items/Import-EC2KeyPair.html) AWS Tools for Windows PowerShell command\.
**To verify that the key pair was imported successfully**
Use the [Get\-EC2KeyPair](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2KeyPair.html) AWS Tools for Windows PowerShell command\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
4865d9affd71-0 | To help categorize and manage your existing key pairs, you can tag them with custom metadata\. For more information about how tags work, see [Tagging your Amazon EC2 resources](Using_Tags.md)\.
You can view, add, and delete tags using the new console and the command line tools\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
498db55df1a2-0 | **To view, add, or delete a tag for an existing key pair**
1. Open the Amazon EC2 console at [https://console\.aws\.amazon\.com/ec2/](https://console.aws.amazon.com/ec2/)\.
1. In the navigation pane, choose **Key Pairs**\.
1. Select a key pair, and then choose **Actions**, **Manage tags**\.
1. The **Manage tags** section displays any tags that are assigned to the key pair\.
+ To add a tag, choose **Add tag**, and then enter the tag key and value\. You can add up to 50 tags per key pair\. For more information, see [Tag restrictions](Using_Tags.md#tag-restrictions)\.
+ To delete a tag, choose **Remove** next to the tag that you want to delete\.
1. Choose **Save changes**\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
75090af0a2a7-0 | **To view key pair tags**
Use the [describe\-tags](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-tags.html) AWS CLI command\. In the following example, you describe the tags for all of your key pairs\.
```
$ aws ec2 describe-tags --filters "Name=resource-type,Values=key-pair"
```
```
{
"Tags": [
{
"Key": "Environment",
"ResourceId": "key-0123456789EXAMPLE",
"ResourceType": "key-pair",
"Value": "Production"
},
{
"Key": "Environment",
"ResourceId": "key-9876543210EXAMPLE",
"ResourceType": "key-pair",
"Value": "Production"
}]
}
```
**To describe the tags for a specific key pair**
Use the [ describe\-key\-pairs](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-key-pairs.html) AWS CLI command\.
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
75090af0a2a7-1 | ```
$ aws ec2 describe-key-pairs --key-pair-ids key-0123456789EXAMPLE
```
```
{
"KeyPairs": [
{
"KeyName": "MyKeyPair",
"KeyFingerprint": "1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f",
"KeyPairId": "key-0123456789EXAMPLE",
"Tags": [
{
"Key": "Environment",
"Value": "Production"
}]
}]
}
```
**To tag an existing key pair**
Use the [create\-tags](https://docs.aws.amazon.com/cli/latest/reference/ec2/create-tags.html) AWS CLI command\. In the following example, the existing key pair is tagged with `Key=Cost-Center` and `Value=CC-123`\.
```
$ aws ec2 create-tags --resources key-0123456789EXAMPLE --tags Key=Cost-Center,Value=CC-123
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
75090af0a2a7-2 | ```
**To delete a tag from a key pair**
Use the [delete\-tags](https://docs.aws.amazon.com/cli/latest/reference/ec2/delete-tags.html) AWS CLI command\. For examples, see [Examples](https://docs.aws.amazon.com/cli/latest/reference/ec2/delete-tags.html#examples) in the *AWS CLI Command Reference*\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
ed59746db0d6-0 | **To view key pair tags**
Use the [Get\-EC2Tag](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2Tag.html) command\.
**To describe the tags for a specific key pair**
Use the [Get\-EC2KeyPair](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2KeyPair.html) command\.
**To tag an existing key pair**
Use the [New\-EC2Tag](https://docs.aws.amazon.com/powershell/latest/reference/items/New-EC2Tag.html) command\.
**To delete a tag from a key pair**
Use the [Remove\-EC2Tag](https://docs.aws.amazon.com/powershell/latest/reference/items/Remove-EC2Tag.html) command\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
c1e6a64ae613-0 | On your local Linux or macOS computer, you can use the ssh\-keygen command to retrieve the public key for your key pair\. Specify the path where you downloaded your private key \(the `.pem` file\)\.
```
ssh-keygen -y -f /path_to_key_pair/my-key-pair.pem
```
The command returns the public key, as shown in the following example\.
```
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQClKsfkNkuSevGj3eYhCe53pcjqP3maAhDFcvBS7O6V
hz2ItxCih+PnDSUaw+WNQn/mZphTk/a/gU8jEzoOWbkM4yxyb/wB96xbiFveSFJuOp/d6RJhJOI0iBXr
lsLnBItntckiJ7FbtxJMXLvvwJryDUilBMTjYtwB+QhYXUMOzce5Pjz5/i8SeJtjnV3iAoG/cQk+0FzZ
qaeJAAHco+CY/5WrUBkrHmFJr6HcXkvJdWPkYQS3xqC0+FmUZofz221CBt5IMucxXPkX4rWi+z7wB3Rb | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
c1e6a64ae613-1 | BQoQzd8v7yeb7OzlPnWOyN0qFU0XA246RA8QFYiCNYwI3f05p6KLxEXAMPLE
```
If the command fails, run the following command to ensure that you've changed the permissions on your key pair file so that only you can view it\.
```
chmod 400 my-key-pair.pem
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
dbcd2863c31e-0 | The public key that you specified when you launched an instance is also available to you through its instance metadata\. To view the public key that you specified when launching the instance, use the following command from your instance:
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
af519aaf972c-0 | ```
[ec2-user ~]$ TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` \
&& curl -H "X-aws-ec2-metadata-token: $TOKEN" –v http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key
```
The following is an example output\.
```
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQClKsfkNkuSevGj3eYhCe53pcjqP3maAhDFcvBS7O6V
hz2ItxCih+PnDSUaw+WNQn/mZphTk/a/gU8jEzoOWbkM4yxyb/wB96xbiFveSFJuOp/d6RJhJOI0iBXr
lsLnBItntckiJ7FbtxJMXLvvwJryDUilBMTjYtwB+QhYXUMOzce5Pjz5/i8SeJtjnV3iAoG/cQk+0FzZ
qaeJAAHco+CY/5WrUBkrHmFJr6HcXkvJdWPkYQS3xqC0+FmUZofz221CBt5IMucxXPkX4rWi+z7wB3Rb | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
af519aaf972c-1 | BQoQzd8v7yeb7OzlPnWOyN0qFU0XA246RA8QFYiCNYwI3f05p6KLxEXAMPLE my-key-pair
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
9e5a085e21b2-0 | ```
[ec2-user ~]$ curl http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key
```
The following is an example output\.
```
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQClKsfkNkuSevGj3eYhCe53pcjqP3maAhDFcvBS7O6V
hz2ItxCih+PnDSUaw+WNQn/mZphTk/a/gU8jEzoOWbkM4yxyb/wB96xbiFveSFJuOp/d6RJhJOI0iBXr
lsLnBItntckiJ7FbtxJMXLvvwJryDUilBMTjYtwB+QhYXUMOzce5Pjz5/i8SeJtjnV3iAoG/cQk+0FzZ
qaeJAAHco+CY/5WrUBkrHmFJr6HcXkvJdWPkYQS3xqC0+FmUZofz221CBt5IMucxXPkX4rWi+z7wB3Rb
BQoQzd8v7yeb7OzlPnWOyN0qFU0XA246RA8QFYiCNYwI3f05p6KLxEXAMPLE my-key-pair
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
9e5a085e21b2-1 | ```
------
If you change the key pair that you use to connect to the instance, we don't update the instance metadata to show the new public key\. Instead, the instance metadata continues to show the public key for the key pair that you specified when you launched the instance\. For more information, see [Retrieving instance metadata](instancedata-data-retrieval.md)\.
Alternatively, on a Linux instance, the public key content is placed in an entry within `~/.ssh/authorized_keys`\. You can open this file in an editor\. The following is an example entry for the key pair named **my\-key\-pair**\. It consists of the public key followed by the name of the key pair\.
```
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQClKsfkNkuSevGj3eYhCe53pcjqP3maAhDFcvBS7O6V
hz2ItxCih+PnDSUaw+WNQn/mZphTk/a/gU8jEzoOWbkM4yxyb/wB96xbiFveSFJuOp/d6RJhJOI0iBXr
lsLnBItntckiJ7FbtxJMXLvvwJryDUilBMTjYtwB+QhYXUMOzce5Pjz5/i8SeJtjnV3iAoG/cQk+0FzZ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
9e5a085e21b2-2 | qaeJAAHco+CY/5WrUBkrHmFJr6HcXkvJdWPkYQS3xqC0+FmUZofz221CBt5IMucxXPkX4rWi+z7wB3Rb
BQoQzd8v7yeb7OzlPnWOyN0qFU0XA246RA8QFYiCNYwI3f05p6KLxEXAMPLE my-key-pair
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
61164f9fcd1a-0 | When you launch an instance, you are [prompted for a key pair](launching-instance.md#step-7-review-instance-launch)\. If you plan to connect to the instance using SSH, you must specify a key pair\. You can choose an existing key pair or create a new one\. When your instance boots for the first time, the content of the public key that you specified at launch is placed on your Linux instance in an entry within `~/.ssh/authorized_keys`\.
**To locate the public key on an instance**
1. Connect to your instance\. For more information, see [Connect to your Linux instance](AccessingInstances.md)\.
1. In the terminal window, open the `authorized_keys` file using your favorite text editor \(such as vim or nano\)\.
```
[ec2-user ~]$ nano ~/.ssh/authorized_keys
```
The `authorized_keys` file opens, displaying the public key, as shown in the following example\.
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
61164f9fcd1a-1 | ```
The `authorized_keys` file opens, displaying the public key, as shown in the following example\.
```
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQClKsfkNkuSevGj3eYhCe53pcjqP3maAhDFcvBS7O6Vhz2ItxCih+PnDSUaw+WNQn/mZphTk/a/gU8jEzoOWbkM4yxyb/wB96xbiFveSFJuOp/d6RJhJOI0iBXrlsLnBItntckiJ7FbtxJMXLvvwJryDUilBMTjYtwB+QhYXUMOzce5Pjz5/i8SeJtjnV3iAoG/cQk+0FzZqaeJAAHco+CY/5WrUBkrHmFJr6HcXkvJdWPkYQS3xqC0+FmUZofz221CBt5IMucxXPkX4rWi+z7wB3RbBQoQzd8v7yeb7OzlPnWOyN0qFU0XA246RA8QFYiCNYwI3f05p6KLxEXAMPLE
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
652e3edde0e5-0 | When you launch an instance, you are [prompted for a key pair](launching-instance.md#step-7-review-instance-launch)\. If you plan to connect to the instance using SSH, you must specify a key pair\.
**To identify the key pair that was specified at launch**
1. Open the Amazon EC2 console at [https://console\.aws\.amazon\.com/ec2/](https://console.aws.amazon.com/ec2/)\.
1. In the navigation pane, choose **Instances**, and then select your instance\.
1. On the **Description** tab, the **Key pair name** field displays the name of the key pair that you specified when you launched the instance\. The value of the **Key pair name** does not change even if you change the public key on the instance, or add key pairs\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
e75beca7d56c-0 | On the **Key Pairs** page in the Amazon EC2 console, the **Fingerprint** column displays the fingerprints generated from your key pairs\. AWS calculates the fingerprint differently depending on whether the key pair was generated by AWS or a third\-party tool\. If you created the key pair using AWS, the fingerprint is calculated using an SHA\-1 hash function\. If you created the key pair with a third\-party tool and uploaded the public key to AWS, or if you generated a new public key from an existing AWS\-created private key and uploaded it to AWS, the fingerprint is calculated using an MD5 hash function\.
You can use the SSH2 fingerprint that's displayed on the **Key Pairs** page to verify that the private key you have on your local machine matches the public key stored in AWS\. From the computer where you downloaded the private key file, generate an SSH2 fingerprint from the private key file\. The output should match the fingerprint that's displayed in the console\.
If you created your key pair using AWS, you can use the OpenSSL tools to generate a fingerprint as shown in the following example\.
```
$ openssl pkcs8 -in path_to_private_key -inform PEM -outform DER -topk8 -nocrypt | openssl sha1 -c
```
If you created a key pair using a third\-party tool and uploaded the public key to AWS, you can use the OpenSSL tools to generate the fingerprint as shown in the following example\.
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
e75beca7d56c-1 | ```
$ openssl rsa -in path_to_private_key -pubout -outform DER | openssl md5 -c
```
If you created an OpenSSH key pair using OpenSSH 7\.8 or later and uploaded the public key to AWS, you can use ssh\-keygen to generate the fingerprint as shown in the following example\.
```
$ ssh-keygen -ef path_to_private_key -m PEM | openssl rsa -RSAPublicKey_in -outform DER | openssl md5 -c
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
4a4b8d5a4bb8-0 | You can change the key pair that is used to access the default system account of your instance\. For example, if a user in your organization requires access to the system user account using a separate key pair, you can add that key pair to your instance\. Or, if someone has a copy of the `.pem` file and you want to prevent them from connecting to your instance \(for example, if they've left your organization\), you can replace the key pair with a new one\.
To add or replace a key pair, you must be able to connect to your instance\. If you've lost your existing private key or you launched your instance without a key pair, you won't be able connect to your instance and therefore won't be able to add or replace a key pair\. If you've lost your existing private key, you might be able to retrieve it\. For more information, see [Connecting to your Linux instance if you lose your private key](replacing-lost-key-pair.md)\. If you launched your instance without a key pair, you won't be able to connect to the instance unless you chose an AMI that is configured to allow users another way to log in\.
**Note**
These procedures are for modifying the key pair for the default user account, such as `ec2-user`\. For more information about adding user accounts to your instance, see [Managing user accounts on your Amazon Linux instance](managing-users.md)\.
**To add or replace a key pair** | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
4a4b8d5a4bb8-1 | **To add or replace a key pair**
1. Create a new key pair using [the Amazon EC2 console](#having-ec2-create-your-key-pair) or a [third\-party tool](#how-to-generate-your-own-key-and-import-it-to-aws)\.
1. Retrieve the public key from your new key pair\. For more information, see [Retrieving the public key for your key pair](#retrieving-the-public-key)\.
1. Connect to your instance using your existing private key file\.
1. Using a text editor of your choice, open the `.ssh/authorized_keys` file on the instance\. Paste the public key information from your new key pair underneath the existing public key information\. Save the file\.
1. Disconnect from your instance, and test that you can connect to your instance using the new private key file\.
1. \(Optional\) If you're replacing an existing key pair, connect to your instance and delete the public key information for the original key pair from the `.ssh/authorized_keys` file\.
**Note**
If you're using an Auto Scaling group, ensure that the key pair you're replacing is not specified in your launch template or launch configuration\. Amazon EC2 Auto Scaling launches a replacement instance if it detects an unhealthy instance; however, the instance launch fails if the key pair cannot be found\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ec2-key-pairs.md |
Subsets and Splits