id
stringlengths 14
16
| text
stringlengths 1
2.43k
| source
stringlengths 99
229
|
---|---|---|
cb477e9e3521-0 | You can purchase a paid AMI by using the Amazon EC2 launch wizard\. For more information, see [Launching an AWS Marketplace instance](launch-marketplace-console.md)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/paid-amis.md |
a2f83b55ed54-0 | To use the AWS Marketplace, you must have an AWS account\. To launch instances from AWS Marketplace products, you must be signed up to use the Amazon EC2 service, and you must be subscribed to the product from which to launch the instance\. There are two ways to subscribe to products in the AWS Marketplace:
+ **AWS Marketplace website**: You can launch preconfigured software quickly with the 1\-Click deployment feature\.
+ **Amazon EC2 launch wizard**: You can search for an AMI and launch an instance directly from the wizard\. For more information, see [Launching an AWS Marketplace instance](launch-marketplace-console.md)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/paid-amis.md |
7ff001ad343e-0 | You can retrieve the AWS Marketplace product code for your instance using its instance metadata\. For more information about retrieving metadata, see [Instance metadata and user data](ec2-instance-metadata.md)\.
To retrieve a product code, use the following command:
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/paid-amis.md |
0c8d8f20b9d8-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/product-codes
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/paid-amis.md |
4cc27240b413-0 | ```
[ec2-user ~]$ curl http://169.254.169.254/latest/meta-data/product-codes
```
------
If the instance has a product code, Amazon EC2 returns it\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/paid-amis.md |
a2cbeb0b29ec-0 | Amazon EC2 also enables developers to offer support for software \(or derived AMIs\)\. Developers can create support products that you can sign up to use\. During sign\-up for the support product, the developer gives you a product code, which you must then associate with your own AMI\. This enables the developer to confirm that your instance is eligible for support\. It also ensures that when you run instances of the product, you are charged according to the terms for the product specified by the developer\.
**Important**
You can't use a support product with Reserved Instances\. You always pay the price that's specified by the seller of the support product\.
To associate a product code with your AMI, use one of the following commands, where *ami\_id* is the ID of the AMI and *product\_code* is the product code:
+ [modify\-image\-attribute](https://docs.aws.amazon.com/cli/latest/reference/ec2/modify-image-attribute.html) \(AWS CLI\)
```
aws ec2 modify-image-attribute --image-id ami_id --product-codes "product_code"
```
+ [Edit\-EC2ImageAttribute](https://docs.aws.amazon.com/powershell/latest/reference/items/Edit-EC2ImageAttribute.html) \(AWS Tools for Windows PowerShell\)
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/paid-amis.md |
a2cbeb0b29ec-1 | ```
PS C:\> Edit-EC2ImageAttribute -ImageId ami_id -ProductCode product_code
```
After you set the product code attribute, it cannot be changed or removed\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/paid-amis.md |
b96a410ad0fa-0 | At the end of each month, you receive an email with the amount your credit card has been charged for using any paid or supported AMIs during the month\. This bill is separate from your regular Amazon EC2 bill\. For more information, see [Paying For AWS Marketplace Products](https://aws.amazon.com/marketplace/help/200799490)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/paid-amis.md |
484949800e98-0 | On the AWS Marketplace website, you can check your subscription details, view the vendor's usage instructions, manage your subscriptions, and more\.
**To check your subscription details**
1. Log in to the [AWS Marketplace](https://aws.amazon.com/marketplace)\.
1. Choose **Your Marketplace Account**\.
1. Choose **Manage your software subscriptions**\.
1. All your current subscriptions are listed\. Choose ** Usage Instructions** to view specific instructions for using the product, for example, a user name for connecting to your running instance\.
**To cancel an AWS Marketplace subscription**
1. Ensure that you have terminated any instances running from the subscription\.
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**\.
1. Select the instance, and choose **Actions**, **Instance State**, **Terminate**\.
1. Choose **Yes, Terminate** when prompted for confirmation\.
1. Log in to the [AWS Marketplace](https://aws.amazon.com/marketplace), and choose **Your Marketplace Account**, then **Manage your software subscriptions**\.
1. Choose **Cancel subscription**\. You are prompted to confirm your cancellation\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/paid-amis.md |
484949800e98-1 | 1. Choose **Cancel subscription**\. You are prompted to confirm your cancellation\.
**Note**
After you've canceled your subscription, you are no longer able to launch any instances from that AMI\. To use that AMI again, you need to resubscribe to it, either on the AWS Marketplace website, or through the launch wizard in the Amazon EC2 console\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/paid-amis.md |
7fb293e47925-0 | You can back up the data on your Amazon EBS volumes to Amazon S3 by taking point\-in\-time snapshots\. Snapshots are *incremental* backups, which means that only the blocks on the device that have changed after your most recent snapshot are saved\. This minimizes the time required to create the snapshot and saves on storage costs by not duplicating data\. Each snapshot contains all of the information that is needed to restore your data \(from the moment when the snapshot was taken\) to a new EBS volume\.
When you create an EBS volume based on a snapshot, the new volume begins as an exact replica of the original volume that was used to create the snapshot\. The replicated volume loads data in the background so that you can begin using it immediately\. If you access data that hasn't been loaded yet, the volume immediately downloads the requested data from Amazon S3, and then continues loading the rest of the volume's data in the background\. For more information, see [Creating Amazon EBS snapshots](ebs-creating-snapshot.md)\.
When you delete a snapshot, only the data unique to that snapshot is removed\. For more information, see [Deleting an Amazon EBS snapshot](ebs-deleting-snapshot.md)\.
**Snapshot events**
You can track the status of your EBS snapshots through CloudWatch Events\. For more information, see [EBS snapshot events](ebs-cloud-watch-events.md#snapshot-events)\.
**Multi\-volume snapshots** | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/EBSSnapshots.md |
7fb293e47925-1 | **Multi\-volume snapshots**
Snapshots can be used to create a backup of critical workloads, such as a large database or a file system that spans across multiple EBS volumes\. Multi\-volume snapshots allow you to take exact point\-in\-time, data coordinated, and crash\-consistent snapshots across multiple EBS volumes attached to an EC2 instance\. You are no longer required to stop your instance or to coordinate between volumes to ensure crash consistency, because snapshots are automatically taken across multiple EBS volumes\. For more information, see the steps for creating a multi\-volume EBS snapshot under [Creating Amazon EBS snapshots](ebs-creating-snapshot.md) \.
**Snapshot pricing**
Charges for your snapshots are based on the amount of data stored\. Because snapshots are incremental, deleting a snapshot might not reduce your data storage costs\. Data referenced exclusively by a snapshot is removed when that snapshot is deleted, but data referenced by other snapshots is preserved\. For more information, see [Amazon Elastic Block Store Volumes and Snapshots](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/checklistforunwantedcharges.html#checkebsvolumes) in the *AWS Billing and Cost Management User Guide*\.
**Topics**
+ [How incremental snapshots work](#how_snapshots_work)
+ [Copying and sharing snapshots](#copy-and-share) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/EBSSnapshots.md |
7fb293e47925-2 | + [Copying and sharing snapshots](#copy-and-share)
+ [Encryption support for snapshots](#encryption-support)
+ [Creating Amazon EBS snapshots](ebs-creating-snapshot.md)
+ [Deleting an Amazon EBS snapshot](ebs-deleting-snapshot.md)
+ [Copying an Amazon EBS snapshot](ebs-copy-snapshot.md)
+ [Viewing Amazon EBS snapshot information](ebs-describing-snapshots.md)
+ [Sharing an Amazon EBS snapshot](ebs-modifying-snapshot-permissions.md)
+ [Accessing the contents of an EBS snapshot](ebs-accessing-snapshot.md)
+ [Automating the Amazon EBS snapshot lifecycle](snapshot-lifecycle.md) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/EBSSnapshots.md |
be9247912462-0 | This section provides illustrations of how an EBS snapshot captures the state of a volume at a point in time, and also how successive snapshots of a changing volume create a history of those changes\.
In the diagram below, Volume 1 is shown at three points in time\. A snapshot is taken of each of these three volume states\.
+ In State 1, the volume has 10 GiB of data\. Because Snap A is the first snapshot taken of the volume, the entire 10 GiB of data must be copied\.
+ In State 2, the volume still contains 10 GiB of data, but 4 GiB have changed\. Snap B needs to copy and store only the 4 GiB that changed after Snap A was taken\. The other 6 GiB of unchanged data, which are already copied and stored in Snap A, are *referenced* by Snap B rather than \(again\) copied\. This is indicated by the dashed arrow\.
+ In State 3, 2 GiB of data have been added to the volume, for a total of 12 GiB\. Snap C needs to copy the 2 GiB that were added after Snap B was taken\. As shown by the dashed arrows, Snap C also references 4 GiB of data stored in Snap B, and 6 GiB of data stored in Snap A\.
+ The total storage required for the three snapshots is 16 GiB\.
**Relations among multiple snapshots of a volume**
![\[Snapshots capturing an initial volume state and two subsequent states after data has been changed.\]](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/images/snapshot_1a.png) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/EBSSnapshots.md |
be9247912462-1 | **Note**
If you copy a snapshot and encrypt it to a new CMK, a complete \(non\-incremental\) copy is always created, resulting in additional delay and storage costs\.
For more information about how data is managed when you delete a snapshot, see [Deleting an Amazon EBS snapshot](ebs-deleting-snapshot.md)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/EBSSnapshots.md |
fb7d6a6eb5c5-0 | You can share a snapshot across AWS accounts by modifying its access permissions\. You can make copies of your own snapshots as well as snapshots that have been shared with you\. For more information, see [Sharing an Amazon EBS snapshot](ebs-modifying-snapshot-permissions.md)\.
A snapshot is constrained to the AWS Region where it was created\. After you create a snapshot of an EBS volume, you can use it to create new volumes in the same Region\. For more information, see [Creating a volume from a snapshot](ebs-creating-volume.md#ebs-create-volume-from-snapshot)\. You can also copy snapshots across Regions, making it possible to use multiple Regions for geographical expansion, data center migration, and disaster recovery\. You can copy any accessible snapshot that has a `completed` status\. For more information, see [Copying an Amazon EBS snapshot](ebs-copy-snapshot.md)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/EBSSnapshots.md |
391480ed729d-0 | EBS snapshots fully support EBS encryption\.
+ Snapshots of encrypted volumes are automatically encrypted\.
+ Volumes that you create from encrypted snapshots are automatically encrypted\.
+ Volumes that you create from an unencrypted snapshot that you own or have access to can be encrypted on\-the\-fly\.
+ When you copy an unencrypted snapshot that you own, you can encrypt it during the copy process\.
+ When you copy an encrypted snapshot that you own or have access to, you can reencrypt it with a different key during the copy process\.
+ The first snapshot you take of an encrypted volume that has been created from an unencrypted snapshot is always a full snapshot\.
+ The first snapshot you take of a reencrypted volume, which has a different CMK compared to the source snapshot, is always a full snapshot\.
**Note**
If you copy a snapshot and encrypt it to a new CMK, a complete \(non\-incremental\) copy is always created, resulting in additional delay and storage costs\.
Complete documentation of possible snapshot encryption scenarios is provided in [Creating Amazon EBS snapshots](ebs-creating-snapshot.md) and in [Copying an Amazon EBS snapshot](ebs-copy-snapshot.md)\.
For more information, see [Amazon EBS encryption](EBSEncryption.md)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/EBSSnapshots.md |
1365142d54a8-0 | You can create a CloudWatch alarm that monitors CloudWatch metrics for one of your instances\. CloudWatch will automatically send you a notification when the metric reaches a threshold you specify\. You can create a CloudWatch alarm using the Amazon EC2 console, or using the more advanced options provided by the CloudWatch console\.
**To create an alarm using the CloudWatch console**
For examples, see [Creating Amazon CloudWatch Alarms](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html) in the *Amazon CloudWatch User Guide*\.
**To create an alarm 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 **Instances**\.
1. Select the instance\.
1. On the **Monitoring** tab located at the bottom of the page, choose **Create Alarm**\. Or, from the **Actions** dropdown, choose **CloudWatch Monitoring**, **Add/Edit Alarm**\.
1. In the **Create Alarm** dialog box, do the following:
1. Choose **create topic**\. For **Send a notification to**, enter a name for the SNS topic\. For **With these recipients**, enter one or more email addresses to receive notification\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/using-cloudwatch-createalarm.md |
1365142d54a8-1 | 1. Specify the metric and the criteria for the policy\. For example, you can leave the default settings for **Whenever** \(Average of CPU Utilization\)\. For **Is**, choose `>=` and enter `80` percent\. For **For at least**, enter `1` consecutive period of `5 Minutes`\.
1. Choose **Create Alarm**\.
![\[Create a CloudWatch alarm using the Amazon EC2 console.\]](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/images/monitoring_create_alarm.png) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/using-cloudwatch-createalarm.md |
6364e8dd9a87-0 | You can use Amazon CloudWatch to collect metrics and logs from the operating systems for your EC2 instances\.
**Important**
The monitoring scripts are deprecated\. We recommend that you use the CloudWatch agent to collect metrics and logs\. We provide this information about the monitoring scripts for customers who are still migrating from the deprecated monitoring scripts to the CloudWatch agent\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
e89161192abf-0 | You can use the CloudWatch agent to collect both system metrics and log files from Amazon EC2 instances and on\-premises servers\. The agent supports both Windows Server and Linux, and enables you to select the metrics to be collected, including sub\-resource metrics such as per\-CPU core\. We recommend that you use the agent to collect metrics and logs instead of using the monitoring scripts\. For more information, see [Collect Metrics from Amazon EC2 Instances and | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
e89161192abf-1 | [Collect Metrics from Amazon EC2 Instances and On\-Premises Servers with the CloudWatch Agent](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html) in the *Amazon CloudWatch User Guide*\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
928abbd2e5e0-0 | **Important**
We provide information about the monitoring scripts for customers who have not yet migrated from the deprecated monitoring scripts to the CloudWatch agent\.
The monitoring scripts demonstrate how to produce and consume custom metrics for Amazon CloudWatch\. These sample Perl scripts comprise a fully functional example that reports memory, swap, and disk space utilization metrics for a Linux instance\.
Standard Amazon CloudWatch usage charges for custom metrics apply to your use of these scripts\. For more information, see the [Amazon CloudWatch](https://aws.amazon.com/cloudwatch/pricing) pricing page\.
**Topics**
+ [Supported systems](#mon-scripts-systems)
+ [Required permissions](#mon-scripts-permissions)
+ [Install required packages](#mon-scripts-perl_prereq)
+ [Install monitoring scripts](#mon-scripts-getstarted)
+ [mon\-put\-instance\-data\.pl](#using_put_script)
+ [mon\-get\-instance\-stats\.pl](#using_get_script_powershell)
+ [Viewing your custom metrics in the console](#script_viewmetrics)
+ [Troubleshooting](#mon-script-troubleshooting) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
2d8864b72dfc-0 | The monitoring scripts were tested on instances using the following systems\. Using the monitoring scripts on any other operating system is unsupported\.
+ Amazon Linux 2
+ Amazon Linux AMI 2014\.09\.2 and later
+ Red Hat Enterprise Linux 6\.9 and 7\.4
+ SUSE Linux Enterprise Server 12
+ Ubuntu Server 14\.04 and 16\.04 | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
21f63cd971d1-0 | Ensure that the scripts have permission to call the following actions by associating an IAM role with your instance:
+ cloudwatch:PutMetricData
+ cloudwatch:GetMetricStatistics
+ cloudwatch:ListMetrics
+ ec2:DescribeTags
For more information, see [Working with IAM roles](iam-roles-for-amazon-ec2.md#working-with-iam-roles)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
ae8048197082-0 | With some versions of Linux, you must install additional Perl modules before you can use the monitoring scripts\.
**To install the required packages on Amazon Linux 2 and Amazon Linux AMI**
1. Log on to your instance\. For more information, see [Connect to your Linux instance](AccessingInstances.md)\.
1. At a command prompt, install packages as follows:
```
sudo yum install -y perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https perl-Digest-SHA.x86_64
```
**To install the required packages on Ubuntu**
1. Log on to your instance\. For more information, see [Connect to your Linux instance](AccessingInstances.md)\.
1. At a command prompt, install packages as follows:
```
sudo apt-get update
sudo apt-get install unzip
sudo apt-get install libwww-perl libdatetime-perl
```
**To install the required packages on Red Hat Enterprise Linux 7**
1. Log on to your instance\. For more information, see [Connect to your Linux instance](AccessingInstances.md)\.
1. At a command prompt, install packages as follows:
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
ae8048197082-1 | 1. At a command prompt, install packages as follows:
```
sudo yum install perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https perl-Digest-SHA --enablerepo="rhui-REGION-rhel-server-optional" -y
sudo yum install zip unzip
```
**To install the required packages on Red Hat Enterprise Linux 6\.9**
1. Log on to your instance\. For more information, see [Connect to your Linux instance](AccessingInstances.md)\.
1. At a command prompt, install packages as follows:
```
sudo yum install perl-DateTime perl-CPAN perl-Net-SSLeay perl-IO-Socket-SSL perl-Digest-SHA gcc -y
sudo yum install zip unzip
```
1. Run CPAN as an elevated user:
```
sudo cpan
```
Press ENTER through the prompts until you see the following prompt:
```
cpan[1]>
```
1. At the CPAN prompt, run each of the below commands: run one command and it installs, and when you return to the CPAN prompt, run the next command\. Press ENTER like before when prompted to continue through the process:
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
ae8048197082-2 | ```
cpan[1]> install YAML
cpan[2]> install LWP::Protocol::https
cpan[3]> install Sys::Syslog
cpan[4]> install Switch
```
**To install the required packages on SUSE**
1. Log on to your instance\. For more information, see [Connect to your Linux instance](AccessingInstances.md)\.
1. On servers running SUSE Linux Enterprise Server 12, you might need to download the `perl-Switch` package\. You can download and install this package using the following commands:
```
wget http://download.opensuse.org/repositories/devel:/languages:/perl/SLE_12_SP3/noarch/perl-Switch-2.17-32.1.noarch.rpm
sudo rpm -i perl-Switch-2.17-32.1.noarch.rpm
```
1. Install the required packages as follows:
```
sudo zypper install perl-Switch perl-DateTime
sudo zypper install βy "perl(LWP::Protocol::https)"
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
08a8132b482b-0 | The following steps show you how to download, uncompress, and configure the CloudWatch Monitoring Scripts on an EC2 Linux instance\.
**To download, install, and configure the monitoring scripts**
1. At a command prompt, move to a folder where you want to store the monitoring scripts and run the following command to download them:
```
curl https://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.2.zip -O
```
1. Run the following commands to install the monitoring scripts you downloaded:
```
unzip CloudWatchMonitoringScripts-1.2.2.zip && \
rm CloudWatchMonitoringScripts-1.2.2.zip && \
cd aws-scripts-mon
```
The package for the monitoring scripts contains the following files:
+ **CloudWatchClient\.pm** β Shared Perl module that simplifies calling Amazon CloudWatch from other scripts\.
+ **mon\-put\-instance\-data\.pl** β Collects system metrics on an Amazon EC2 instance \(memory, swap, disk space utilization\) and sends them to Amazon CloudWatch\.
+ **mon\-get\-instance\-stats\.pl** β Queries Amazon CloudWatch and displays the most recent utilization statistics for the EC2 instance on which this script is executed\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
08a8132b482b-1 | + **awscreds\.template** β File template for AWS credentials that stores your access key ID and secret access key\.
+ **LICENSE\.txt** β Text file containing the Apache 2\.0 license\.
+ **NOTICE\.txt** β Copyright notice\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
e3f2efa9fbe1-0 | This script collects memory, swap, and disk space utilization data on the current system\. It then makes a remote call to Amazon CloudWatch to report the collected data as custom metrics\.
**Options**
| Name | Description |
| --- | --- |
| `--mem-util ` | Collects and sends the MemoryUtilization metrics in percentages\. This metric counts memory allocated by applications and the operating system as used, and also includes cache and buffer memory as used if you specify the `--mem-used-incl-cache-buff` option\. |
| `--mem-used ` | Collects and sends the MemoryUsed metrics, reported in megabytes\. This metric counts memory allocated by applications and the operating system as used, and also includes cache and buffer memory as used if you specify the `--mem-used-incl-cache-buff` option\. |
| `--mem-used-incl-cache-buff ` | If you include this option, memory currently used for cache and buffers is counted as "used" when the metrics are reported for `--mem-util`, `--mem-used`, and `--mem-avail`\. |
| `--mem-avail ` | Collects and sends the MemoryAvailable metrics, reported in megabytes\. This metric counts memory allocated by applications and the operating system as used, and also includes cache and buffer memory as used if you specify the `--mem-used-incl-cache-buff` option\. | | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
e3f2efa9fbe1-1 | | `--swap-util ` | Collects and sends SwapUtilization metrics, reported in percentages\. |
| `--swap-used ` | Collects and sends SwapUsed metrics, reported in megabytes\. |
| `--disk-path=PATH ` | Selects the disk on which to report\. PATH can specify a mount point or any file located on a mount point for the filesystem that needs to be reported\. For selecting multiple disks, specify a `--disk-path=PATH` for each one of them\. To select a disk for the filesystems mounted on `/` and `/home`, use the following parameters: `--disk-path=/ --disk-path=/home` |
| `--disk-space-util` | Collects and sends the DiskSpaceUtilization metric for the selected disks\. The metric is reported in percentages\. Note that the disk utilization metrics calculated by this script differ from the values calculated by the df \-k \-l command\. If you find the values from df \-k \-l more useful, you can change the calculations in the script\. |
| `--disk-space-used` | Collects and sends the DiskSpaceUsed metric for the selected disks\. The metric is reported by default in gigabytes\. Due to reserved disk space in Linux operating systems, disk space used and disk space available might not accurately add up to the amount of total disk space\. | | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
e3f2efa9fbe1-2 | | `--disk-space-avail ` | Collects and sends the DiskSpaceAvailable metric for the selected disks\. The metric is reported in gigabytes\. Due to reserved disk space in the Linux operating systems, disk space used and disk space available might not accurately add up to the amount of total disk space\. |
| `--memory-units=UNITS ` | Specifies units in which to report memory usage\. If not specified, memory is reported in megabytes\. UNITS may be one of the following: bytes, kilobytes, megabytes, gigabytes\. |
| `--disk-space-units=UNITS ` | Specifies units in which to report disk space usage\. If not specified, disk space is reported in gigabytes\. UNITS may be one of the following: bytes, kilobytes, megabytes, gigabytes\. |
| `--aws-credential- file=PATH ` | Provides the location of the file containing AWS credentials\. This parameter cannot be used with the `--aws-access-key-id` and \-`-aws-secret-key` parameters\. |
| `--aws-access-key-id=VALUE ` | Specifies the AWS access key ID to use to identify the caller\. Must be used together with the `--aws-secret-key` option\. Do not use this option with the `--aws-credential-file` parameter\. | | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
e3f2efa9fbe1-3 | | `--aws-secret-key=VALUE ` | Specifies the AWS secret access key to use to sign the request to CloudWatch\. Must be used together with the `--aws-access-key-id` option\. Do not use this option with `--aws-credential-file` parameter\. |
| `--aws-iam-role=VALUE` | Specifies the IAM role used to provide AWS credentials\. The value `=VALUE` is required\. If no credentials are specified, the default IAM role associated with the EC2 instance is applied\. Only one IAM role can be used\. If no IAM roles are found, or if more than one IAM role is found, the script will return an error\. Do not use this option with the `--aws-credential-file`, `--aws-access-key-id`, or `--aws-secret-key` parameters\. |
| `--aggregated[=only]` | Adds aggregated metrics for instance type, AMI ID, and overall for the Region\. The value `=only` is optional; if specified, the script reports only aggregated metrics\. | | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
e3f2efa9fbe1-4 | | `--auto-scaling[=only]` | Adds aggregated metrics for the Auto Scaling group\. The value `=only` is optional; if specified, the script reports only Auto Scaling metrics\. The [IAM policy](https://docs.aws.amazon.com/IAM/latest/UserGuide/ManagingPolicies.html) associated with the IAM account or role using the scripts need to have permissions to call the EC2 action [DescribeTags](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeTags.html)\. |
| `--verify ` | Performs a test run of the script that collects the metrics, prepares a complete HTTP request, but does not actually call CloudWatch to report the data\. This option also checks that credentials are provided\. When run in verbose mode, this option outputs the metrics that will be sent to CloudWatch\. |
| `--from-cron ` | Use this option when calling the script from cron\. When this option is used, all diagnostic output is suppressed, but error messages are sent to the local system log of the user account\. |
| `--verbose ` | Displays detailed information about what the script is doing\. |
| `--help ` | Displays usage information\. |
| `--version ` | Displays the version number of the script\. |
**Examples** | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
e3f2efa9fbe1-5 | | `--version ` | Displays the version number of the script\. |
**Examples**
The following examples assume that you provided an IAM role or `awscreds.conf` file\. Otherwise, you must provide credentials using the `--aws-access-key-id` and `--aws-secret-key` parameters for these commands\.
The following example performs a simple test run without posting data to CloudWatch\.
```
./mon-put-instance-data.pl --mem-util --verify --verbose
```
The following example collects all available memory metrics and sends them to CloudWatch, counting cache and buffer memory as used
```
./mon-put-instance-data.pl --mem-used-incl-cache-buff --mem-util --mem-used --mem-avail
```
The following example collects aggregated metrics for an Auto Scaling group and sends them to Amazon CloudWatch without reporting individual instance metrics\.
```
./mon-put-instance-data.pl --mem-util --mem-used --mem-avail --auto-scaling=only
```
The following example collects aggregated metrics for instance type, AMI ID and region, and sends them to Amazon CloudWatch without reporting individual instance metrics
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
e3f2efa9fbe1-6 | The following example collects aggregated metrics for instance type, AMI ID and region, and sends them to Amazon CloudWatch without reporting individual instance metrics
```
./mon-put-instance-data.pl --mem-util --mem-used --mem-avail --aggregated=only
```
To set a cron schedule for metrics reported to CloudWatch, start editing the crontab using the crontab \-e command\. Add the following command to report memory and disk space utilization to CloudWatch every five minutes:
```
1. */5 * * * * ~/aws-scripts-mon/mon-put-instance-data.pl --mem-used-incl-cache-buff --mem-util --disk-space-util --disk-path=/ --from-cron
```
If the script encounters an error, it writes the error message in the system log\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
fc81a2de9ac4-0 | This script queries CloudWatch for statistics on memory, swap, and disk space metrics within the time interval provided using the number of most recent hours\. This data is provided for the Amazon EC2 instance on which this script is executed\.
**Options**
| Name | Description |
| --- | --- |
| `--recent-hours=N` | Specifies the number of recent hours to report on, as represented by `N` where N is an integer\. |
| `--aws-credential-file=PATH ` | Provides the location of the file containing AWS credentials\. |
| `--aws-access-key-id=VALUE ` | Specifies the AWS access key ID to use to identify the caller\. Must be used together with the `--aws-secret-key` option\. Do not use this option with the `--aws-credential-file` option\. |
| `--aws-secret-key=VALUE ` | Specifies the AWS secret access key to use to sign the request to CloudWatch\. Must be used together with the `--aws-access-key-id` option\. Do not use this option with `--aws-credential-file` option\. | | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
fc81a2de9ac4-1 | | `--aws-iam-role=VALUE` | Specifies the IAM role used to provide AWS credentials\. The value `=VALUE` is required\. If no credentials are specified, the default IAM role associated with the EC2 instance is applied\. Only one IAM role can be used\. If no IAM roles are found, or if more than one IAM role is found, the script will return an error\. Do not use this option with the `--aws-credential-file`, `--aws-access-key-id`, or `--aws-secret-key` parameters\. |
| `--verify ` | Performs a test run of the script\. This option also checks that credentials are provided\. |
| `--verbose ` | Displays detailed information about what the script is doing\. |
| `--help ` | Displays usage information\. |
| `--version ` | Displays the version number of the script\. |
**Example**
To get utilization statistics for the last 12 hours, run the following command:
```
./mon-get-instance-stats.pl --recent-hours=12
```
The following is an example response:
```
Instance metric statistics for the last 12 hours.
CPU Utilization
Average: 1.06%, Minimum: 0.00%, Maximum: 15.22%
Memory Utilization
Average: 6.84%, Minimum: 6.82%, Maximum: 6.89%
Swap Utilization | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
fc81a2de9ac4-2 | Memory Utilization
Average: 6.84%, Minimum: 6.82%, Maximum: 6.89%
Swap Utilization
Average: N/A, Minimum: N/A, Maximum: N/A
Disk Space Utilization on /dev/xvda1 mounted as /
Average: 9.69%, Minimum: 9.69%, Maximum: 9.69%
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
971eddd2b8aa-0 | After you successfully run the `mon-put-instance-data.pl` script, you can view your custom metrics in the Amazon CloudWatch console\.
**To view custom metrics**
1. Run `mon-put-instance-data.pl` as described previously\.
1. Open the CloudWatch console at [https://console\.aws\.amazon\.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/)\.
1. Choose **View Metrics**\.
1. For **Viewing**, your custom metrics posted by the script are displayed with the prefix `System/Linux`\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
2d63a0a22b35-0 | The **CloudWatchClient\.pm** module caches instance metadata locally\. If you create an AMI from an instance where you have run the monitoring scripts, any instances launched from the AMI within the cache TTL \(default: six hours, 24 hours for Auto Scaling groups\) emit metrics using the instance ID of the original instance\. After the cache TTL time period passes, the script retrieves fresh data and the monitoring scripts use the instance ID of the current instance\. To immediately correct this, remove the cached data using the following command:
```
rm /var/tmp/aws-mon/instance-id
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/mon-scripts.md |
423979d283b1-0 | Secure Sockets Layer/Transport Layer Security \(SSL/TLS\) creates an encrypted channel between a web server and web client that protects data in transit from being eavesdropped on\. This tutorial explains how to add support manually for SSL/TLS on an EC2 instance with Amazon Linux 2 and Apache web server\. If you plan to offer commercial\-grade services, the [AWS Certificate Manager](https://aws.amazon.com/certificate-manager/), which is not discussed here, is a good option\.
For historical reasons, web encryption is often referred to simply as SSL\. While web browsers still support SSL, its successor protocol TLS is less vulnerable to attack\. Amazon Linux 2 disables server\-side support for all versions of SSL by default\. [Security standards bodies](https://www.ssl.com/article/deprecating-early-tls/) consider TLS 1\.0 to be unsafe, and both TLS 1\.0 and TLS 1\.1 are on track to be formally [deprecated](https://tools.ietf.org/html/draft-ietf-tls-oldversions-deprecate-03) by the IETF\. This tutorial contains guidance based exclusively on enabling TLS 1\.2\. \(A newer TLS 1\.3 protocol exists, but it is not installed by default on Amazon Linux 2\.\) For more information about the updated encryption standards, see [RFC 7568](https://tools.ietf.org/html/rfc7568) and [RFC 8446](https://tools.ietf.org/html/rfc8446)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
423979d283b1-1 | This tutorial refers to modern web encryption simply as TLS\.
**Important**
These procedures are intended for use with Amazon Linux 2\. We also assume that you are starting with a fresh Amazon EC2 instance\. If you are trying to set up a LAMP web server on an instance with a different distribution, or if you are reusing an older, existing instance, some procedures in this tutorial might not work for you\. For information about LAMP web servers on Ubuntu, see the Ubuntu community documentation [ApacheMySQLPHP](https://help.ubuntu.com/community/ApacheMySQLPHP)\. For information about Red Hat Enterprise Linux, see the Customer Portal topic [Web Servers](https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/ch-Web_Servers.html)\.
**Topics**
+ [Prerequisites](#ssl_prereq)
+ [Step 1: Enable TLS on the server](#ssl_enable)
+ [Step 2: Obtain a CA\-signed certificate](#ssl_certificate)
+ [Step 3: Test and harden the security configuration](#ssl_test)
+ [Troubleshooting](#troubleshooting)
+ [Certificate automation: Let's Encrypt with Certbot on Amazon Linux 2](#letsencrypt) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
3d851dfbda4b-0 | Before you begin this tutorial, complete the following steps:
+ Launch an EBS\-backed Amazon Linux 2 instance\. For more information, see [Step 1: Launch an instance](EC2_GetStarted.md#ec2-launch-instance)\.
+ Configure your security groups to allow your instance to accept connections on the following TCP ports:
+ SSH \(port 22\)
+ HTTP \(port 80\)
+ HTTPS \(port 443\)
For more information, see [Authorizing inbound traffic for your Linux instances](authorizing-access-to-an-instance.md)\.
+ Install the Apache web server\. For step\-by\-step instructions, see [Tutorial: Install a LAMP Web Server on Amazon Linux 2](ec2-lamp-amazon-linux-2.md)\. Only the httpd package and its dependencies are needed, so you can ignore the instructions involving PHP and MariaDB\.
+ To identify and authenticate websites, the TLS public key infrastructure \(PKI\) relies on the Domain Name System \(DNS\)\. To use your EC2 instance to host a public website, you need to register a domain name for your web server or transfer an existing domain name to your Amazon EC2 host\. Numerous third\-party domain registration and DNS hosting services are available for this, or you can use [Amazon Route 53](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/Welcome.html)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
c41e8b1b381c-0 | This procedure takes you through the process of setting up TLS on Amazon Linux 2 with a self\-signed digital certificate\.
**Note**
A self\-signed certificate is acceptable for testing but not production\. If you expose your self\-signed certificate to the internet, visitors to your site are greeted by security warnings\.
**To enable TLS on a server**
1. [Connect to your instance](EC2_GetStarted.md#ec2-connect-to-instance-linux) and confirm that Apache is running\.
```
[ec2-user ~]$ sudo systemctl is-enabled httpd
```
If the returned value is not "enabled," start Apache and set it to start each time the system boots\.
```
[ec2-user ~]$ sudo systemctl start httpd && sudo systemctl enable httpd
```
1. To ensure that all of your software packages are up to date, perform a quick software update on your instance\. This process may take a few minutes, but it is important to make sure that you have the latest security updates and bug fixes\.
**Note**
The `-y` option installs the updates without asking for confirmation\. If you would like to examine the updates before installing, you can omit this option\.
```
[ec2-user ~]$ sudo yum update -y
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
c41e8b1b381c-1 | ```
[ec2-user ~]$ sudo yum update -y
```
1. Now that your instance is current, add TLS support by installing the Apache module `mod_ssl`\.
```
[ec2-user ~]$ sudo yum install -y mod_ssl
```
Your instance now has the following files that you use to configure your secure server and create a certificate for testing:
+ `/etc/httpd/conf.d/ssl.conf`
The configuration file for mod\_ssl\. It contains *directives* telling Apache where to find encryption keys and certificates, the TLS protocol versions to allow, and the encryption ciphers to accept\.
+ `/etc/pki/tls/certs/make-dummy-cert`
A script to generate a self\-signed X\.509 certificate and private key for your server host\. This certificate is useful for testing that Apache is properly set up to use TLS\. Because it offers no proof of identity, it should not be used in production\. If used in production, it triggers warnings in Web browsers\.
1. Run the script to generate a self\-signed dummy certificate and key for testing\.
```
[ec2-user ~]$ cd /etc/pki/tls/certs
sudo ./make-dummy-cert localhost.crt
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
c41e8b1b381c-2 | sudo ./make-dummy-cert localhost.crt
```
This generates a new file `localhost.crt` in the `/etc/pki/tls/certs/` directory\. The specified file name matches the default that is assigned in the SSLCertificateFile directive in `/etc/httpd/conf.d/ssl.conf`\.
This file contains both a self\-signed certificate and the certificate's private key\. Apache requires the certificate and key to be in PEM format, which consists of Base64\-encoded ASCII characters framed by "BEGIN" and "END" lines, as in the following abbreviated example\.
```
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQD2KKx/8Zk94m1q
3gQMZF9ZN66Ls19+3tHAgQ5Fpo9KJDhzLjOOCI8u1PTcGmAah5kEitCEc0wzmNeo
BCl0wYR6G0rGaKtK9Dn7CuIjvubtUysVyQoMVPQ97ldeakHWeRMiEJFXg6kZZ0vr
GvwnKoMh3DlK44D9dX7IDua2PlYx5+eroA+1Lqf32ZSaAO0bBIMIYTHigwbHMZoT
... | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
c41e8b1b381c-3 | ...
56tE7THvH7vOEf4/iUOsIrEzaMaJ0mqkmY1A70qQGQKBgBF3H1qNRNHuyMcPODFs
27hDzPDinrquSEvoZIggkDMlh2irTiipJ/GhkvTpoQlv0fK/VXw8vSgeaBuhwJvS
LXU9HvYq0U6O4FgD3nAyB9hI0BE13r1HjUvbjT7moH+RhnNz6eqqdscCS09VtRAo
4QQvAqOa8UheYeoXLdWcHaLP
-----END PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
MIIEazCCA1OgAwIBAgICWxQwDQYJKoZIhvcNAQELBQAwgbExCzAJBgNVBAYTAi0t
MRIwEAYDVQQIDAlTb21lU3RhdGUxETAPBgNVBAcMCFNvbWVDaXR5MRkwFwYDVQQK
DBBTb21lT3JnYW5pemF0aW9uMR8wHQYDVQQLDBZTb21lT3JnYW5pemF0aW9uYWxV
bml0MRkwFwYDVQQDDBBpcC0xNzItMzEtMjAtMjM2MSQwIgYJKoZIhvcNAQkBFhVy
... | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
c41e8b1b381c-4 | ...
z5rRUE/XzxRLBZOoWZpNWTXJkQ3uFYH6s/sBwtHpKKZMzOvDedREjNKAvk4ws6F0
CuIjvubtUysVyQoMVPQ97ldeakHWeRMiEJFXg6kZZ0vrGvwnKoMh3DlK44D9dlU3
WanXWehT6FiSZvB4sTEXXJN2jdw8g+sHGnZ8zCOsclknYhHrCVD2vnBlZJKSZvak
3ZazhBxtQSukFMOnWPP2a0DMMFGYUHOd0BQE8sBJxg==
-----END CERTIFICATE-----
```
The file names and extensions are a convenience and have no effect on function\. For example, you can call a certificate `cert.crt`, `cert.pem`, or any other file name, so long as the related directive in the `ssl.conf` file uses the same name\.
**Note**
When you replace the default TLS files with your own customized files, be sure that they are in PEM format\.
1. Open the `/etc/httpd/conf.d/ssl.conf` file and comment out the following line, because the self\-signed dummy certificate also contains the key\. If you do not comment out this line before you complete the next step, the Apache service fails to start\.
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
c41e8b1b381c-5 | ```
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
```
1. Restart Apache\.
```
[ec2-user ~]$ sudo systemctl restart httpd
```
**Note**
Make sure that TCP port 443 is accessible on your EC2 instance, as previously described\.
1. Your Apache web server should now support HTTPS \(secure HTTP\) over port 443\. Test it by entering the IP address or fully qualified domain name of your EC2 instance into a browser URL bar with the prefix **https://**\.
Because you are connecting to a site with a self\-signed, untrusted host certificate, your browser may display a series of security warnings\. Override the warnings and proceed to the site\.
If the default Apache test page opens, it means that you have successfully configured TLS on your server\. All data passing between the browser and server is now encrypted\.
**Note**
To prevent site visitors from encountering warning screens, you must obtain a trusted, CA\-signed certificate that not only encrypts, but also publicly authenticates you as the owner of the site\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
828d58541d78-0 | You can use the following process to obtain a CA\-signed certificate:
+ Generate a certificate signing request \(CSR\) from a private key
+ Submit the CSR to a certificate authority \(CA\)
+ Obtain a signed host certificate
+ Configure Apache to use the certificate
A self\-signed TLS X\.509 host certificate is cryptologically identical to a CA\-signed certificate\. The difference is social, not mathematical\. A CA promises, at a minimum, to validate a domain's ownership before issuing a certificate to an applicant\. Each web browser contains a list of CAs trusted by the browser vendor to do this\. An X\.509 certificate consists primarily of a public key that corresponds to your private server key, and a signature by the CA that is cryptographically tied to the public key\. When a browser connects to a web server over HTTPS, the server presents a certificate for the browser to check against its list of trusted CAs\. If the signer is on the list, or accessible through a *chain of trust* consisting of other trusted signers, the browser negotiates a fast encrypted data channel with the server and loads the page\.
**Important** | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
828d58541d78-1 | **Important**
Certificates generally cost money because of the labor involved in validating the requests, so it pays to shop around\. A list of well\-known CAs can be found at [dmoztools\.net](http://dmoztools.net/Computers/Security/Public_Key_Infrastructure/PKIX/Tools_and_Services/Third_Party_Certificate_Authorities/)\. A few CAs offer basic\-level certificates free of charge\. The most notable of these CAs is the [Let's Encrypt](https://letsencrypt.org/) project, which also supports the automation of the certificate creation and renewal process\. For more information about using Let's Encrypt as your CA, see [Certificate automation: Let's Encrypt with Certbot on Amazon Linux 2](#letsencrypt)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
828d58541d78-2 | Underlying the host certificate is the key\. As of 2019, [government](http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-57pt1r4.pdf) and [industry](https://cabforum.org/wp-content/uploads/CA-Browser-Forum-BR-1.6.5.pdf) groups recommend using a minimum key \(modulus\) size of 2048 bits for RSA keys intended to protect documents, through 2030\. The default modulus size generated by OpenSSL in Amazon Linux 2 is 2048 bits, which is suitable for use in a CA\-signed certificate\. In the following procedure, an optional step provided for those who want a customized key, for example, one with a larger modulus or using a different encryption algorithm\.
These instructions for acquiring a CA\-signed host certificate do not work unless you own a registered and hosted DNS domain\.
**To obtain a CA\-signed certificate**
1. [Connect to your instance](EC2_GetStarted.md#ec2-connect-to-instance-linux) and navigate to /etc/pki/tls/private/\. This is the directory where you store the server's private key for TLS\. If you prefer to use an existing host key to generate the CSR, skip to Step 3\.
1. \(Optional\) Generate a new private key\. Here are some examples of key configurations\. Any of the resulting keys works with your web server, but they vary in the degree and type of security that they implement\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
828d58541d78-3 | + **Example 1:** Create a default RSA host key\. The resulting file, **custom\.key**, is a 2048\-bit RSA private key\.
```
[ec2-user ~]$ sudo openssl genrsa -out custom.key
```
+ **Example 2:** Create a stronger RSA key with a bigger modulus\. The resulting file, **custom\.key**, is a 4096\-bit RSA private key\.
```
[ec2-user ~]$ sudo openssl genrsa -out custom.key 4096
```
+ **Example 3:** Create a 4096\-bit encrypted RSA key with password protection\. The resulting file, **custom\.key**, is a 4096\-bit RSA private key encrypted with the AES\-128 cipher\.
**Important**
Encrypting the key provides greater security, but because an encrypted key requires a password, services depending on it cannot be auto\-started\. Each time you use this key, you must supply the password \(in the preceding example, "abcde12345"\) over an SSH connection\.
```
[ec2-user ~]$ sudo openssl genrsa -aes128 -passout pass:abcde12345 -out custom.key 4096
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
828d58541d78-4 | ```
+ **Example 4:** Create a key using a non\-RSA cipher\. RSA cryptography can be relatively slow because of the size of its public keys, which are based on the product of two large prime numbers\. However, it is possible to create keys for TLS that use non\-RSA ciphers\. Keys based on the mathematics of elliptic curves are smaller and computationally faster when delivering an equivalent level of security\.
```
[ec2-user ~]$ sudo openssl ecparam -name prime256v1 -out custom.key -genkey
```
The result is a 256\-bit elliptic curve private key using prime256v1, a "named curve" that OpenSSL supports\. Its cryptographic strength is slightly greater than a 2048\-bit RSA key, [according to NIST](http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-57pt1r4.pdf)\.
**Note**
Not all CAs provide the same level of support for elliptic\-curve\-based keys as for RSA keys\.
Make sure that the new private key has highly restrictive ownership and permissions \(owner=root, group=root, read/write for owner only\)\. The commands would be as shown in the following example\.
```
[ec2-user ~]$ sudo chown root:root custom.key
[ec2-user ~]$ sudo chmod 600 custom.key | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
828d58541d78-5 | [ec2-user ~]$ sudo chmod 600 custom.key
[ec2-user ~]$ ls -al custom.key
```
The preceding commands yield the following result\.
```
-rw------- root root custom.key
```
After you have created and configured a satisfactory key, you can create a CSR\.
1. Create a CSR using your preferred key\. The following example uses **custom\.key**\.
```
[ec2-user ~]$ sudo openssl req -new -key custom.key -out csr.pem
```
OpenSSL opens a dialog and prompts you for the information shown in the following table\. All of the fields except **Common Name** are optional for a basic, domain\-validated host certificate\.
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/SSL-on-amazon-linux-2.html)
Finally, OpenSSL prompts you for an optional challenge password\. This password applies only to the CSR and to transactions between you and your CA, so follow the CA's recommendations about this and the other optional field, optional company name\. The CSR challenge password has no effect on server operation\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
828d58541d78-6 | The resulting file **csr\.pem** contains your public key, your digital signature of your public key, and the metadata that you entered\.
1. Submit the CSR to a CA\. This usually consists of opening your CSR file in a text editor and copying the contents into a web form\. At this time, you may be asked to supply one or more subject alternate names \(SANs\) to be placed on the certificate\. If **www\.example\.com** is the common name, then **example\.com** would be a good SAN, and vice versa\. A visitor to your site entering either of these names would see an error\-free connection\. If your CA web form allows it, include the common name in the list of SANs\. Some CAs include it automatically\.
After your request has been approved, you receive a new host certificate signed by the CA\. You might also be instructed to download an *intermediate certificate* file that contains additional certificates needed to complete the CA's chain of trust\.
**Note**
Your CA might send you files in multiple formats intended for various purposes\. For this tutorial, you should only use a certificate file in PEM format, which is usually \(but not always\) marked with a `.pem` or `.crt` file extension\. If you are uncertain which file to use, open the files with a text editor and find the one containing one or more blocks beginning with the following line\.
```
- - - - -BEGIN CERTIFICATE - - - - -
```
The file should also end with the following line\.
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
828d58541d78-7 | ```
The file should also end with the following line\.
```
- - - -END CERTIFICATE - - - - -
```
You can also test the file at the command line as shown in the following\.
```
[ec2-user certs]$ openssl x509 -in certificate.crt -text
```
Verify that these lines appear in the file\. Do not use files ending with `.p7b`, `.p7c`, or similar file extensions\.
1. Place the new CA\-signed certificate and any intermediate certificates in the `/etc/pki/tls/certs` directory\.
**Note**
There are several ways to upload your new certificate to your EC2 instance, but the most straightforward and informative way is to open a text editor \(for example, vi, nano, or notepad\) on both your local computer and your instance, and then copy and paste the file contents between them\. You need root \[sudo\] permissions when performing these operations on the EC2 instance\. This way, you can see immediately if there are any permission or path problems\. Be careful, however, not to add any additional lines while copying the contents, or to change them in any way\.
From inside the `/etc/pki/tls/certs` directory, check that the file ownership, group, and permission settings match the highly restrictive Amazon Linux 2 defaults \(owner=root, group=root, read/write for owner only\)\. The following example shows the commands to use\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
828d58541d78-8 | ```
[ec2-user certs]$ sudo chown root:root custom.crt
[ec2-user certs]$ sudo chmod 600 custom.crt
[ec2-user certs]$ ls -al custom.crt
```
These commands should yield the following result\.
```
-rw------- root root custom.crt
```
The permissions for the intermediate certificate file are less stringent \(owner=root, group=root, owner can write, group can read, world can read\)\. The following example shows the commands to use\.
```
[ec2-user certs]$ sudo chown root:root intermediate.crt
[ec2-user certs]$ sudo chmod 644 intermediate.crt
[ec2-user certs]$ ls -al intermediate.crt
```
These commands should yield the following result\.
```
-rw-r--r-- root root intermediate.crt
```
1. Place the private key that you used to create the CSR in the `/etc/pki/tls/private/` directory\.
**Note** | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
828d58541d78-9 | **Note**
There are several ways to upload your custom key to your EC2 instance, but the most straightforward and informative way is to open a text editor \(for example, vi, nano, or notepad\) on both your local computer and your instance, and then copy and paste the file contents between them\. You need root \[sudo\] permissions when performing these operations on the EC2 instance\. This way, you can see immediately if there are any permission or path problems\. Be careful, however, not to add any additional lines while copying the contents, or to change them in any way\.
From inside the `/etc/pki/tls/private` directory, use the following commands to verify that the file ownership, group, and permission settings match the highly restrictive Amazon Linux 2 defaults \(owner=root, group=root, read/write for owner only\)\.
```
[ec2-user private]$ sudo chown root:root custom.key
[ec2-user private]$ sudo chmod 600 custom.key
[ec2-user private]$ ls -al custom.key
```
These commands should yield the following result\.
```
-rw------- root root custom.key
```
1. Edit `/etc/httpd/conf.d/ssl.conf` to reflect your new certificate and key files\.
1. Provide the path and file name of the CA\-signed host certificate in Apache's `SSLCertificateFile` directive: | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
828d58541d78-10 | 1. Provide the path and file name of the CA\-signed host certificate in Apache's `SSLCertificateFile` directive:
```
SSLCertificateFile /etc/pki/tls/certs/custom.crt
```
1. If you received an intermediate certificate file \(`intermediate.crt` in this example\), provide its path and file name using Apache's `SSLCACertificateFile` directive:
```
SSLCACertificateFile /etc/pki/tls/certs/intermediate.crt
```
**Note**
Some CAs combine the host certificate and the intermediate certificates in a single file, making the `SSLCACertificateFile` directive unnecessary\. Consult the instructions provided by your CA\.
1. Provide the path and file name of the private key \(`custom.key` in this example\) in Apache's `SSLCertificateKeyFile` directive:
```
SSLCertificateKeyFile /etc/pki/tls/private/custom.key
```
1. Save `/etc/httpd/conf.d/ssl.conf` and restart Apache\.
```
[ec2-user ~]$ sudo systemctl restart httpd
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
828d58541d78-11 | ```
[ec2-user ~]$ sudo systemctl restart httpd
```
1. Test your server by entering your domain name into a browser URL bar with the prefix `https://`\. Your browser should load the test page over HTTPS without generating errors\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
9bf6e8ed4396-0 | After your TLS is operational and exposed to the public, you should test how secure it really is\. This is easy to do using online services such as [Qualys SSL Labs](https://www.ssllabs.com/ssltest/analyze.html), which performs a free and thorough analysis of your security setup\. Based on the results, you may decide to harden the default security configuration by controlling which protocols you accept, which ciphers you prefer, and which you exclude\. For more information, see [how Qualys formulates its scores](https://github.com/ssllabs/research/wiki/SSL-Server-Rating-Guide)\.
**Important**
Real\-world testing is crucial to the security of your server\. Small configuration errors may lead to serious security breaches and loss of data\. Because recommended security practices change constantly in response to research and emerging threats, periodic security audits are essential to good server administration\.
On the [Qualys SSL Labs](https://www.ssllabs.com/ssltest/analyze.html) site, enter the fully qualified domain name of your server, in the form **www\.example\.com**\. After about two minutes, you receive a grade \(from A to F\) for your site and a detailed breakdown of the findings\. The following table summarizes the report for a domain with settings identical to the default Apache configuration on Amazon Linux 2, and with a default Certbot certificate\.
| | |
| --- |--- |
| Overall rating | B |
| Certificate | 100% | | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
9bf6e8ed4396-1 | | | |
| --- |--- |
| Overall rating | B |
| Certificate | 100% |
| Protocol support | 95% |
| Key exchange | 70% |
| Cipher strength | 90% |
Though the overview shows that the configuration is mostly sound, the detailed report flags several potential problems, listed here in order of severity:
β **The RC4 cipher is supported for use by certain older browsers\.** A cipher is the mathematical core of an encryption algorithm\. RC4, a fast cipher used to encrypt TLS data\-streams, is known to have several [serious weaknesses](http://www.imperva.com/docs/hii_attacking_ssl_when_using_rc4.pdf)\. Unless you have very good reasons to support legacy browsers, you should disable this\.
β **Old TLS versions are supported\.** The configuration supports TLS 1\.0 \(already deprecated\) and TLS 1\.1 \(on a path to deprecation\)\. Only TLS 1\.2 has been recommended since 2018\.
β **Forward secrecy is not fully supported\.** [Forward secrecy](https://en.wikipedia.org/wiki/Forward_secrecy) is a feature of algorithms that encrypt using temporary \(ephemeral\) session keys derived from the private key\. This means in practice that attackers cannot decrypt HTTPS data even if they possess a web server's long\-term private key\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
9bf6e8ed4396-2 | **To correct and future\-proof the TLS configuration**
1. Open the configuration file `/etc/httpd/conf.d/ssl.conf` in a text editor and comment out the following line by entering "\#" at the beginning of the line\.
```
#SSLProtocol all -SSLv3
```
1. Add the following directive:
```
#SSLProtocol all -SSLv3
SSLProtocol -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 +TLSv1.2
```
This directive explicitly disables SSL versions 2 and 3, as well as TLS versions 1\.0 and 1\.1\. The server now refuses to accept encrypted connections with clients using anything except TLS 1\.2\. The verbose wording in the directive conveys more clearly, to a human reader, what the server is configured to do\.
**Note**
Disabling TLS versions 1\.0 and 1\.1 in this manner blocks a small percentage of outdated web browsers from accessing your site\.
**To modify the list of allowed ciphers**
1. In the configuration file `/etc/httpd/conf.d/ssl.conf`, find the section with the **SSLCipherSuite** directive and comment out the existing line by entering "\#" at the beginning of the line\.
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
9bf6e8ed4396-3 | ```
#SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
```
1. Specify explicit cipher suites and a cipher order that prioritizes forward secrecy and avoids insecure ciphers\. The `SSLCipherSuite` directive used here is based on output from the [Mozilla SSL Configuration Generator](https://mozilla.github.io/server-side-tls/ssl-config-generator/), which tailors a TLS configuration to the specific software running on your server\. \(For more information, see Mozilla's useful resource [Security/Server Side TLS](https://wiki.mozilla.org/Security/Server_Side_TLS)\.\) First determine your Apache and OpenSSL versions by using the output from the following commands\.
```
[ec2-user ~]$ yum list installed | grep httpd
[ec2-user ~]$ yum list installed | grep openssl
```
For example, if the returned information is Apache 2\.4\.34 and OpenSSL 1\.0\.2, we enter this into the generator\. If you choose the "modern" compatibility model, this creates an `SSLCipherSuite` directive that aggressively enforces security but still works for most browsers\. If your software doesn't support the modern configuration, you can update your software or choose the "intermediate" configuration instead\.
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
9bf6e8ed4396-4 | ```
SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:
ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:
ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
```
The selected ciphers have *ECDHE* in their names, an abbreviation for *Elliptic Curve Diffie\-Hellman Ephemeral *\. The term *ephemeral* indicates forward secrecy\. As a by\-product, these ciphers do not support RC4\.
We recommend that you use an explicit list of ciphers instead of relying on defaults or terse directives whose content isn't visible\.
Copy the generated directive into `/etc/httpd/conf.d/ssl.conf`\.
**Note** | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
9bf6e8ed4396-5 | Copy the generated directive into `/etc/httpd/conf.d/ssl.conf`\.
**Note**
Though shown here on several lines for readability, the directive must be on a single line when copied to `/etc/httpd/conf.d/ssl.conf`, with only a colon \(no spaces\) between cipher names\.
1. Finally, uncomment the following line by removing the "\#" at the beginning of the line\.
```
#SSLHonorCipherOrder on
```
This directive forces the server to prefer high\-ranking ciphers, including \(in this case\) those that support forward secrecy\. With this directive turned on, the server tries to establish a strong secure connection before falling back to allowed ciphers with lesser security\.
After completing both of these procedures, save the changes to `/etc/httpd/conf.d/ssl.conf` and restart Apache\.
If you test the domain again on [Qualys SSL Labs](https://www.ssllabs.com/ssltest/analyze.html), you should see that the RC4 vulnerability and other warnings are gone and the summary looks something like the following\.
| | |
| --- |--- |
| Overall rating | A |
| Certificate | 100% |
| Protocol support | 100% |
| Key exchange | 90% |
| Cipher strength | 90% |
**Important** | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
9bf6e8ed4396-6 | | Protocol support | 100% |
| Key exchange | 90% |
| Cipher strength | 90% |
**Important**
Each update to OpenSSL introduces new ciphers and removes support for old ones\. Keep your EC2 Amazon Linux 2 instance up\-to\-date, watch for security announcements from [OpenSSL](https://www.openssl.org/), and be alert to reports of new security exploits in the technical press\. For more information, see [Predefined SSL Security Policies for Elastic Load Balancing](https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-security-policy-table.html) in the *User Guide for Classic Load Balancers*\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
ddc11d0bfe5a-0 | + **My Apache webserver doesn't start unless I supply a password**
This is expected behavior if you installed an encrypted, password\-protected, private server key\.
You can remove the encryption and password requirement from the key\. Assuming that you have a private encrypted RSA key called `custom.key` in the default directory, and that the password on it is **abcde12345**, run the following commands on your EC2 instance to generate an unencrypted version of the key\.
```
[ec2-user ~]$ cd /etc/pki/tls/private/
[ec2-user private]$ sudo cp custom.key custom.key.bak
[ec2-user private]$ sudo openssl rsa -in custom.key -passin pass:abcde12345 -out custom.key.nocrypt
[ec2-user private]$ sudo mv custom.key.nocrypt custom.key
[ec2-user private]$ sudo chown root:root custom.key
[ec2-user private]$ sudo chmod 600 custom.key
[ec2-user private]$ sudo systemctl restart httpd
```
Apache should now start without prompting you for a password\.
+ **I get errors when I run **sudo yum install \-y mod\_ssl**\.**
When you are installing the required packages for SSL, you may see errors similar to the following\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
ddc11d0bfe5a-1 | When you are installing the required packages for SSL, you may see errors similar to the following\.
```
Error: httpd24-tools conflicts with httpd-tools-2.2.34-1.16.amzn1.x86_64
Error: httpd24 conflicts with httpd-2.2.34-1.16.amzn1.x86_64
```
This typically means that your EC2 instance is not running Amazon Linux 2\. This tutorial only supports instances freshly created from an official Amazon Linux 2 AMI\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
88886c38ed3a-0 | The [Let's Encrypt](https://letsencrypt.org/) certificate authority is the centerpiece of an effort by the Electronic Frontier Foundation \(EFF\) to encrypt the entire internet\. In line with that goal, Let's Encrypt host certificates are designed to be created, validated, installed, and maintained with minimal human intervention\. The automated aspects of certificate management are carried out by a software agent running on your web server\. After you install and configure the agent, it communicates securely with Let's Encrypt and performs administrative tasks on Apache and the key management system\. This tutorial uses the free [Certbot](https://certbot.eff.org) agent because it allows you either to supply a customized encryption key as the basis for your certificates, or to allow the agent itself to create a key based on its defaults\. You can also configure Certbot to renew your certificates on a regular basis without human interaction, as described in [To automate Certbot](#automate_certbot)\. For more information, consult the Certbot [User Guide](https://certbot.eff.org/docs/using.html) and [man page](http://manpages.ubuntu.com/manpages/bionic/en/man1/certbot.1.html)\.
Certbot is not officially supported on Amazon Linux 2, but is available for download and functions correctly when installed\. We recommend that you make the following backups to protect your data and avoid inconvenience: | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
88886c38ed3a-1 | + Before you begin, take a snapshot of your Amazon EBS root volume\. This allows you to restore the original state of your EC2 instance\. For information about creating EBS snapshots, see [Creating Amazon EBS snapshots](ebs-creating-snapshot.md)\.
+ The procedure below requires you to edit your `httpd.conf` file, which controls Apache's operation\. Certbot makes its own automated changes to this and other configuration files\. Make a backup copy of your entire `/etc/httpd` directory in case you need to restore it\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
2ee95936d618-0 | Complete the following procedures before you install Certbot\.
1. Download the Extra Packages for Enterprise Linux \(EPEL\) 7 repository packages\. These are required to supply dependencies needed by Certbot\.
1. Navigate to your home directory \(`/home/ec2-user`\)\. Download EPEL with the following command\.
```
[ec2-user ~]$ sudo wget -r --no-parent -A 'epel-release-*.rpm' http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/
```
1. Install the repository packages as shown in the following command\.
```
[ec2-user ~]$ sudo rpm -Uvh dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-*.rpm
```
1. Enable EPEL as shown in the following command\.
```
[ec2-user ~]$ sudo yum-config-manager --enable epel*
```
You can confirm that EPEL is enabled with the following command\. It should return information similar to the following\.
```
[ec2-user ~]$ sudo yum repolist all
...
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 enabled: 12949+175 | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
2ee95936d618-1 | ...
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 enabled: 12949+175
epel-debuginfo/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 - Debug enabled: 2890
epel-source/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 - Source enabled: 0
epel-testing/x86_64 Extra Packages for Enterprise Linux 7 - Testing - x86_64 enabled: 778+12
epel-testing-debuginfo/x86_64 Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Debug enabled: 107
epel-testing-source/x86_64 Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Source enabled: 0
...
```
1. Edit the main Apache configuration file, `/etc/httpd/conf/httpd.conf`\. Locate the "`Listen 80`" directive and add the following lines after it, replacing the example domain names with the actual Common Name and Subject Alternative Name \(SAN\)\.
```
<VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName "example.com"
ServerAlias "www.example.com"
</VirtualHost>
```
Save the file and restart Apache\.
```
[ec2-user ~]$ sudo systemctl restart httpd | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
2ee95936d618-2 | Save the file and restart Apache\.
```
[ec2-user ~]$ sudo systemctl restart httpd
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
0d146f2e8f4c-0 | This procedure is based on the EFF documentation for installing Certbot on [ Fedora](https://certbot.eff.org/docs/install.html#alternate-installation-methods) and on [RHEL 7](https://certbot.eff.org/#centosrhel7-apache)\. It describes the default use of Certbot, resulting in a certificate based on a 2048\-bit RSA key\.
1. Install Certbot packages and dependencies using the following command\.
```
[ec2-user ~]$ sudo yum install -y certbot python2-certbot-apache
```
1. Run Certbot\.
```
[ec2-user ~]$ sudo certbot
```
1. At the prompt "Enter email address \(used for urgent renewal and security notices\)," enter a contact address and press Enter\.
1. Agree to the Let's Encrypt Terms of Service at the prompt\. Enter "A" and press Enter to proceed\.
```
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
0d146f2e8f4c-1 | agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A
```
1. At the authorization for EFF to put you on their mailing list, enter "Y" or "N" and press Enter\.
1. Certbot displays the Common Name and Subject Alternative Name \(SAN\) that you provided in the VirtualHost block\.
```
Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: example.com
2: www.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel):
```
Leave the input blank and press Enter\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
0d146f2e8f4c-2 | blank to select all options shown (Enter 'c' to cancel):
```
Leave the input blank and press Enter\.
1. Certbot displays the following output as it creates certificates and configures Apache\. It then prompts you about redirecting HTTP queries to HTTPS\.
```
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for example.com
http-01 challenge for www.example.com
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/httpd/conf/httpd-le-ssl.conf
Deploying Certificate for example.com to VirtualHost /etc/httpd/conf/httpd-le-ssl.conf
Enabling site /etc/httpd/conf/httpd-le-ssl.conf by adding Include to root configuration
Deploying Certificate for www.example.com to VirtualHost /etc/httpd/conf/httpd-le-ssl.conf
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
0d146f2e8f4c-3 | 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel):
```
To allow visitors to connect to your server via unencrypted HTTP, enter "1"\. If you want to accept only encrypted connections via HTTPS, enter "2"\. Press Enter to submit your choice\.
1. Certbot completes the configuration of Apache and reports success and other information\.
```
Congratulations! You have successfully enabled https://example.com and
https://www.example.com
You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=example.com
https://www.ssllabs.com/ssltest/analyze.html?d=www.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at: | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
0d146f2e8f4c-4 | IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/certbot.oneeyedman.net/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/certbot.oneeyedman.net/privkey.pem
Your cert will expire on 2019-08-01. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
```
1. After you complete the installation, test and optimize the security of your server as described in [Step 3: Test and harden the security configuration](#ssl_test)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
d09053601bc1-0 | Certbot is designed to become an invisible, error\-resistant part of your server system\. By default, it generates host certificates with a short, 90\-day expiration time\. If you have not configured your system to call the command automatically, you must re\-run the certbot command manually before expiration\. This procedure shows how to automate Certbot by setting up a cron job\.<a name="automate_certbot"></a>
**To automate Certbot**
1. Open the `/etc/crontab` file in a text editor, such as vim or nano, using sudo\. Alternatively, use sudo crontab \-e\.
1. Add a line similar to the following and save the file\.
```
39 1,13 * * * root certbot renew --no-self-upgrade
```
Here is an explanation of each component:
`39 1,13 * * *`
Schedules a command to be run at 01:39 and 13:39 every day\. The selected values are arbitrary, but the Certbot developers suggest running the command at least twice daily\. This guarantees that any certificate found to be compromised is promptly revoked and replaced\.
`root`
The command runs with root permissions\.
`certbot renew --no-self-upgrade` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
d09053601bc1-1 | `root`
The command runs with root permissions\.
`certbot renew --no-self-upgrade`
The command to be run\. The renew subcommand causes Certbot to check any previously obtained certificates and to renew those that are approaching expiration\. The `--no-self-upgrade` flag prevents Certbot from upgrading itself without your intervention\.
1. Restart the cron daemon\.
```
[ec2-user ~]$ sudo systemctl restart crond
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/SSL-on-amazon-linux-2.md |
6361aaea13aa-0 | Burstable performance instances are designed to provide a baseline level of CPU performance with the ability to burst to a higher level when required by your workload\. Burstable performance instances are well suited for a wide range of general\-purpose applications\. Examples include microservices, low\-latency interactive applications, small and medium databases, virtual desktops, development, build, and stage environments, code repositories, and product prototypes\.
Burstable performance instances are the only instance types that use credits for CPU usage\. For more information about instance pricing and additional hardware details, see [Amazon EC2 Pricing](https://aws.amazon.com/ec2/pricing/) and [Amazon EC2 Instance Types](https://aws.amazon.com/ec2/instance-types/)\.
If your account is less than 12 months old, you can use a `t2.micro` instance for free \(or a `t3.micro` instance in Regions where `t2.micro` is unavailable\) within certain usage limits\. For more information, see [AWS Free Tier](https://aws.amazon.com/free/)\.
**Topics**
+ [Burstable performance instance requirements](#burstable-performance-instances-limits)
+ [Best practices](#burstable-performance-instances-best-practices)
+ [CPU credits and baseline utilization for burstable performance instances](burstable-credits-baseline-concepts.md)
+ [Unlimited mode for burstable performance instances](burstable-performance-instances-unlimited-mode.md) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/burstable-performance-instances.md |
6361aaea13aa-1 | + [Unlimited mode for burstable performance instances](burstable-performance-instances-unlimited-mode.md)
+ [Standard mode for burstable performance instances](burstable-performance-instances-standard-mode.md)
+ [Working with burstable performance instances](burstable-performance-instances-how-to.md)
+ [Monitoring your CPU credits](burstable-performance-instances-monitoring-cpu-credits.md) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/burstable-performance-instances.md |
27b665b99ac2-0 | The following are the requirements for these instances:
+ The supported instance families are: T2, T3, T3a, and T4g\.
+ These instances are available as On\-Demand Instances, Reserved Instances, Dedicated Instances, and Spot Instances, but not as Scheduled Instances\. They are also not supported on a Dedicated Host\. For more information, see [Instance purchasing options](instance-purchasing-options.md)\.
+ Ensure that the instance size you choose passes the minimum memory requirements of your operating system and applications\. Operating systems with graphical user interfaces that consume significant memory and CPU resources \(for example, Windows\) might require a `t2.micro` or larger instance size for many use cases\. As the memory and CPU requirements of your workload grow over time, you can scale to larger instance sizes of the same instance type, or another instance type\.
+ For additional requirements, see [General Purpose Instances Release Notes](general-purpose-instances.md#general-purpose-instances-limits)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/burstable-performance-instances.md |
61ca05606aa5-0 | Follow these best practices to get the maximum benefit from burstable performance instances\.
+ **Use a recommended AMI** β Use an AMI that provides the required drivers\. For more information, see [Release notes](general-purpose-instances.md#general-purpose-instances-limits)\.
+ **Turn on instance recovery** β Create a CloudWatch alarm that monitors an EC2 instance and automatically recovers it if it becomes impaired for any reason\. For more information, see [Adding recover actions to Amazon CloudWatch alarms](UsingAlarmActions.md#AddingRecoverActions)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/burstable-performance-instances.md |
c739a7845ff9-0 | Amazon EBS emits notifications based on Amazon CloudWatch Events for a variety of volume, snapshot, and encryption status changes\. With CloudWatch Events, you can establish rules that trigger programmatic actions in response to a change in volume, snapshot, or encryption key state\. For example, when a snapshot is created, you can trigger an AWS Lambda function to share the completed snapshot with another account or copy it to another Region for disaster\-recovery purposes\.
Events in CloudWatch are represented as JSON objects\. The fields that are unique to the event are contained in the "detail" section of the JSON object\. The "event" field contains the event name\. The "result" field contains the completed status of the action that triggered the event\. For more information, see [Event Patterns in CloudWatch Events](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html) in the *Amazon CloudWatch Events User Guide*\.
For more information, see [Using Events](https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/WhatIsCloudWatchEvents.html) in the *Amazon CloudWatch User Guide*\.
**Topics**
+ [EBS volume events](#volume-events)
+ [EBS snapshot events](#snapshot-events)
+ [EBS volume modification events](#volume-modification-events)
+ [EBS fast snapshot restore events](#fast-snapshot-restore-events) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md |
c739a7845ff9-1 | + [EBS fast snapshot restore events](#fast-snapshot-restore-events)
+ [Using AWS Lambda to handle CloudWatch events](#using_lambda) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md |
79de53f01827-0 | Amazon EBS sends events to CloudWatch Events when the following volume events occur\.
**Topics**
+ [createVolume](#create-volume)
+ [deleteVolume](#delete-volume)
+ [attachVolume](#attach-fail-key) | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md |
d3cedd425728-0 | The `createVolume` event is sent to your AWS account when an action to create a volume completes\. However it is not saved, logged, or archived\. This event can have a result of either `available` or `failed`\. Creation will fail if an invalid KMS key was provided, as shown in the examples below\.
**Event data**
The listing below is an example of a JSON object emitted by EBS for a successful `createVolume` event\.
```
{
"version": "0",
"id": "01234567-0123-0123-0123-012345678901",
"detail-type": "EBS Volume Notification",
"source": "aws.ec2",
"account": "012345678901",
"time": "yyyy-mm-ddThh:mm:ssZ",
"region": "us-east-1",
"resources": [
"arn:aws:ec2:us-east-1:012345678901:volume/vol-01234567"
],
"detail": {
"result": "available",
"cause": "",
"event": "createVolume", | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md |
d3cedd425728-1 | "result": "available",
"cause": "",
"event": "createVolume",
"request-id": "01234567-0123-0123-0123-0123456789ab"
}
}
```
The listing below is an example of a JSON object emitted by EBS after a failed `createVolume` event\. The cause for the failure was a disabled KMS key\.
```
{
"version": "0",
"id": "01234567-0123-0123-0123-0123456789ab",
"detail-type": "EBS Volume Notification",
"source": "aws.ec2",
"account": "012345678901",
"time": "yyyy-mm-ddThh:mm:ssZ",
"region": "sa-east-1",
"resources": [
"arn:aws:ec2:sa-east-1:0123456789ab:volume/vol-01234567",
],
"detail": {
"event": "createVolume",
"result": "failed", | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md |
d3cedd425728-2 | ],
"detail": {
"event": "createVolume",
"result": "failed",
"cause": "arn:aws:kms:sa-east-1:0123456789ab:key/01234567-0123-0123-0123-0123456789ab is disabled.",
"request-id": "01234567-0123-0123-0123-0123456789ab",
}
}
```
The following is an example of a JSON object that is emitted by EBS after a failed `createVolume` event\. The cause for the failure was a KMS key pending import\.
```
{
"version": "0",
"id": "01234567-0123-0123-0123-0123456789ab",
"detail-type": "EBS Volume Notification",
"source": "aws.ec2",
"account": "012345678901",
"time": "yyyy-mm-ddThh:mm:ssZ",
"region": "sa-east-1",
"resources": [ | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md |
d3cedd425728-3 | "region": "sa-east-1",
"resources": [
"arn:aws:ec2:sa-east-1:0123456789ab:volume/vol-01234567",
],
"detail": {
"event": "createVolume",
"result": "failed",
"cause": "arn:aws:kms:sa-east-1:0123456789ab:key/01234567-0123-0123-0123-0123456789ab is pending import.",
"request-id": "01234567-0123-0123-0123-0123456789ab",
}
}
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md |
e43a636777bd-0 | The `deleteVolume` event is sent to your AWS account when an action to delete a volume completes\. However it is not saved, logged, or archived\. This event has the result `deleted`\. If the deletion does not complete, the event is never sent\.
**Event data**
The listing below is an example of a JSON object emitted by EBS for a successful `deleteVolume` event\.
```
{
"version": "0",
"id": "01234567-0123-0123-0123-012345678901",
"detail-type": "EBS Volume Notification",
"source": "aws.ec2",
"account": "012345678901",
"time": "yyyy-mm-ddThh:mm:ssZ",
"region": "us-east-1",
"resources": [
"arn:aws:ec2:us-east-1:012345678901:volume/vol-01234567"
],
"detail": {
"result": "deleted",
"cause": "",
"event": "deleteVolume",
"request-id": "01234567-0123-0123-0123-0123456789ab" | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md |
e43a636777bd-1 | "request-id": "01234567-0123-0123-0123-0123456789ab"
}
}
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md |
f88de1679414-0 | The `attachVolume` or `reattachVolume` event is sent to your AWS account if a volume fails to attach or reattach to an instance\. However it is not saved, logged, or archived\. If you use a KMS key to encrypt an EBS volume and the key becomes invalid, EBS will emit an event if that key is later used to attach or reattach to an instance, as shown in the examples below\.
**Event data**
The listing below is an example of a JSON object emitted by EBS after a failed `attachVolume` event\. The cause for the failure was a KMS key pending deletion\.
**Note**
AWS may attempt to reattach to a volume following routine server maintenance\.
```
{
"version": "0",
"id": "01234567-0123-0123-0123-0123456789ab",
"detail-type": "EBS Volume Notification",
"source": "aws.ec2",
"account": "012345678901",
"time": "yyyy-mm-ddThh:mm:ssZ",
"region": "us-east-1",
"resources": [
"arn:aws:ec2:us-east-1:0123456789ab:volume/vol-01234567", | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md |
f88de1679414-1 | "arn:aws:ec2:us-east-1:0123456789ab:volume/vol-01234567",
"arn:aws:kms:us-east-1:0123456789ab:key/01234567-0123-0123-0123-0123456789ab"
],
"detail": {
"event": "attachVolume",
"result": "failed",
"cause": "arn:aws:kms:us-east-1:0123456789ab:key/01234567-0123-0123-0123-0123456789ab is pending deletion.",
"request-id": ""
}
}
```
The listing below is an example of a JSON object emitted by EBS after a failed `reattachVolume` event\. The cause for the failure was a KMS key pending deletion\.
```
{
"version": "0",
"id": "01234567-0123-0123-0123-0123456789ab",
"detail-type": "EBS Volume Notification",
"source": "aws.ec2",
"account": "012345678901", | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md |
f88de1679414-2 | "source": "aws.ec2",
"account": "012345678901",
"time": "yyyy-mm-ddThh:mm:ssZ",
"region": "us-east-1",
"resources": [
"arn:aws:ec2:us-east-1:0123456789ab:volume/vol-01234567",
"arn:aws:kms:us-east-1:0123456789ab:key/01234567-0123-0123-0123-0123456789ab"
],
"detail": {
"event": "reattachVolume",
"result": "failed",
"cause": "arn:aws:kms:us-east-1:0123456789ab:key/01234567-0123-0123-0123-0123456789ab is pending deletion.",
"request-id": ""
}
}
``` | https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.