id
stringlengths
14
16
text
stringlengths
1
2.43k
source
stringlengths
99
229
16655c4c9848-0
Amazon EBS sends events to CloudWatch Events when the following volume events occur\. **Topics** + [createSnapshot](#create-snapshot-complete) + [createSnapshots](#create-snapshots-complete) + [copySnapshot](#copy-snapshot-complete) + [shareSnapshot](#snapshot-shared)
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
5ac836da8bcd-0
The `createSnapshot` event is sent to your AWS account when an action to create a snapshot completes\. However it is not saved, logged, or archived\. This event can have a result of either `succeeded` or `failed`\. **Event data** The listing below is an example of a JSON object emitted by EBS for a successful `createSnapshot` event\. In the `detail` section, the `source` field contains the ARN of the source volume\. The `startTime` and `endTime` fields indicate when creation of the snapshot started and completed\. ``` { "version": "0", "id": "01234567-0123-0123-0123-012345678901", "detail-type": "EBS Snapshot Notification", "source": "aws.ec2", "account": "012345678901", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-east-1", "resources": [ "arn:aws:ec2:us-west-2::snapshot/snap-01234567" ], "detail": { "event": "createSnapshot", "result": "succeeded", "cause": "",
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
5ac836da8bcd-1
"event": "createSnapshot", "result": "succeeded", "cause": "", "request-id": "", "snapshot_id": "arn:aws:ec2:us-west-2::snapshot/snap-01234567", "source": "arn:aws:ec2:us-west-2::volume/vol-01234567", "startTime": "yyyy-mm-ddThh:mm:ssZ", "endTime": "yyyy-mm-ddThh:mm:ssZ" } } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
b0a633e6791e-0
The `createSnapshots` event is sent to your AWS account when an action to create a multi\-volume snapshot completes\. This event can have a result of either `succeeded` or `failed`\. **Event data** The listing below is an example of a JSON object emitted by EBS for a successful `createSnapshots` event\. In the `detail` section, the `source` field contains the ARNs of the source volumes of the multi\-volume snapshot set\. The `startTime` and `endTime` fields indicate when creation of the snapshot started and completed\. ``` { "version": "0", "id": "01234567-0123-0123-0123-012345678901", "detail-type": "EBS Multi-Volume Snapshots Completion Status", "source": "aws.ec2", "account": "012345678901", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-east-1", "resources": [ "arn:aws:ec2::us-east-1:snapshot/snap-01234567", "arn:aws:ec2::us-east-1:snapshot/snap-012345678" ], "detail": {
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
b0a633e6791e-1
], "detail": { "event": "createSnapshots", "result": "succeeded", "cause": "", "request-id": "", "startTime": "yyyy-mm-ddThh:mm:ssZ", "endTime": "yyyy-mm-ddThh:mm:ssZ", "snapshots": [ { "snapshot_id": "arn:aws:ec2::us-east-1:snapshot/snap-01234567", "source": "arn:aws:ec2::us-east-1:volume/vol-01234567", "status": "completed" }, { "snapshot_id": "arn:aws:ec2::us-east-1:snapshot/snap-012345678", "source": "arn:aws:ec2::us-east-1:volume/vol-012345678", "status": "completed" } ] } } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
b0a633e6791e-2
"status": "completed" } ] } } ``` The listing below is an example of a JSON object emitted by EBS after a failed `createSnapshots` event\. The cause for the failure was one or more snapshots failed to complete\. The values of `snapshot_id` are the ARNs of the failed snapshots\. `startTime` and `endTime` represent when the create\-snapshots action started and ended\. ``` { "version": "0", "id": "01234567-0123-0123-0123-012345678901", "detail-type": "EBS Multi-Volume Snapshots Completion Status", "source": "aws.ec2", "account": "012345678901", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-east-1", "resources": [ "arn:aws:ec2::us-east-1:snapshot/snap-01234567", "arn:aws:ec2::us-east-1:snapshot/snap-012345678" ], "detail": { "event": "createSnapshots",
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
b0a633e6791e-3
], "detail": { "event": "createSnapshots", "result": "failed", "cause": "Snapshot snap-01234567 is in status deleted", "request-id": "", "startTime": "yyyy-mm-ddThh:mm:ssZ", "endTime": "yyyy-mm-ddThh:mm:ssZ", "snapshots": [ { "snapshot_id": "arn:aws:ec2::us-east-1:snapshot/snap-01234567", "source": "arn:aws:ec2::us-east-1:volume/vol-01234567", "status": "error" }, { "snapshot_id": "arn:aws:ec2::us-east-1:snapshot/snap-012345678", "source": "arn:aws:ec2::us-east-1:volume/vol-012345678", "status": "deleted" } ] } } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
79ca697c7610-0
The `copySnapshot` event is sent to your AWS account when an action to copy a snapshot completes\. However it is not saved, logged, or archived\. This event can have a result of either `succeeded` or `failed`\. **Event data** The listing below is an example of a JSON object emitted by EBS after a successful `copySnapshot` event\. The value of `snapshot_id` is the ARN of the newly created snapshot\. In the `detail` section, the value of `source` is the ARN of the source snapshot\. `startTime` and `endTime` represent when the copy\-snapshot action started and ended\. ``` { "version": "0", "id": "01234567-0123-0123-0123-012345678901", "detail-type": "EBS Snapshot Notification", "source": "aws.ec2", "account": "123456789012", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-east-1", "resources": [ "arn:aws:ec2:us-west-2::snapshot/snap-01234567" ], "detail": { "event": "copySnapshot",
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
79ca697c7610-1
], "detail": { "event": "copySnapshot", "result": "succeeded", "cause": "", "request-id": "", "snapshot_id": "arn:aws:ec2:us-west-2::snapshot/snap-01234567", "source": "arn:aws:ec2:eu-west-1::snapshot/snap-76543210", "startTime": "yyyy-mm-ddThh:mm:ssZ", "endTime": "yyyy-mm-ddThh:mm:ssZ", "Incremental": "True" } } ``` The listing below is an example of a JSON object emitted by EBS after a failed `copySnapshot` event\. The cause for the failure was an invalid source snapshot ID\. The value of `snapshot_id` is the ARN of the failed snapshot\. In the `detail` section, the value of `source` is the ARN of the source snapshot\. `startTime` and `endTime` represent when the copy\-snapshot action started and ended\. ``` { "version": "0", "id": "01234567-0123-0123-0123-012345678901",
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
79ca697c7610-2
"id": "01234567-0123-0123-0123-012345678901", "detail-type": "EBS Snapshot Notification", "source": "aws.ec2", "account": "123456789012", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-east-1", "resources": [ "arn:aws:ec2:us-west-2::snapshot/snap-01234567" ], "detail": { "event": "copySnapshot", "result": "failed", "cause": "Source snapshot ID is not valid", "request-id": "", "snapshot_id": "arn:aws:ec2:us-west-2::snapshot/snap-01234567", "source": "arn:aws:ec2:eu-west-1::snapshot/snap-76543210", "startTime": "yyyy-mm-ddThh:mm:ssZ", "endTime": "yyyy-mm-ddThh:mm:ssZ" } } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
6014a50dbae4-0
The `shareSnapshot` event is sent to your AWS account when another account shares a snapshot with it\. However it is not saved, logged, or archived\. The result is always `succeeded`\. **Event data** The following is an example of a JSON object emitted by EBS after a completed `shareSnapshot` event\. In the `detail` section, the value of `source` is the AWS account number of the user that shared the snapshot with you\. `startTime` and `endTime` represent when the share\-snapshot action started and ended\. The `shareSnapshot` event is emitted only when a private snapshot is shared with another user\. Sharing a public snapshot does not trigger the event\. ``` { "version": "0", "id": "01234567-01234-0123-0123-012345678901", "detail-type": "EBS Snapshot Notification", "source": "aws.ec2", "account": "012345678901", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-east-1", "resources": [ "arn:aws:ec2:us-west-2::snapshot/snap-01234567" ], "detail": {
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
6014a50dbae4-1
], "detail": { "event": "shareSnapshot", "result": "succeeded", "cause": "", "request-id": "", "snapshot_id": "arn:aws:ec2:us-west-2::snapshot/snap-01234567", "source": 012345678901, "startTime": "yyyy-mm-ddThh:mm:ssZ", "endTime": "yyyy-mm-ddThh:mm:ssZ" } } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
c8074a4afbf2-0
Amazon EBS sends `modifyVolume` events to CloudWatch Events when a volume is modified\. However it is not saved, logged, or archived\. ``` { "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-03a55cf56513fa1b6" ], "detail": { "result": "optimizing", "cause": "", "event": "modifyVolume", "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
059fdb26e281-0
Amazon EBS sends events to CloudWatch Events when the state of fast snapshot restore for a snapshot changes\. The following is example data for this event\. ``` { "version": "0", "id": "01234567-0123-0123-0123-012345678901", "detail-type": "EBS Fast Snapshot Restore State-change Notification", "source": "aws.ec2", "account": "123456789012", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-east-1", "resources": [ "arn:aws:ec2:us-east-1::snapshot/snap-03a55cf56513fa1b6" ], "detail": { "snapshot-id": "snap-1234567890abcdef0", "state": "optimizing", "zone": "us-east-1a", "message": "Client.UserInitiated - Lifecycle state transition", } } ``` The possible values for `state` are `enabling`, `optimizing`, `enabled`, `disabling`, and `disabled`\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
059fdb26e281-1
The possible values for `state` are `enabling`, `optimizing`, `enabled`, `disabling`, and `disabled`\. The possible values for `message` are as follows: `Client.InvalidSnapshot.InvalidState - The requested snapshot transitioned to an invalid state (Error)` A request to enable fast snapshot restore failed and the state transitioned to `disabling` or `disabled`\. Fast snapshot restore cannot be enabled for this snapshot\. `Client.UserInitiated` The state successfully transitioned to `enabling` or `disabling`\. `Client.UserInitiated - Lifecycle state transition` The state successfully transitioned to `optimizing`, `enabled`, or `disabled`\. `Server.InsufficientCapacity - There was insufficient capacity available to satisfy the request` A request to enable fast snapshot restore failed due to insufficient capacity, and the state transitioned to `disabling` or `disabled`\. Wait and then try again\. `Server.InternalError - An internal error caused the operation to fail` A request to enable fast snapshot restore failed due to an internal error, and the state transitioned to `disabling` or `disabled`\. Wait and then try again\. `Client.InvalidSnapshot.InvalidState - The requested snapshot was deleted or access permissions were revoked`
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
059fdb26e281-2
`Client.InvalidSnapshot.InvalidState - The requested snapshot was deleted or access permissions were revoked` The fast snapshot restore state for the snapshot has transitioned to `disabling` or `disabled` because the snapshot was deleted or unshared by the snapshot owner\. Fast snapshot restore cannot be enabled for a snapshot that has been deleted or is no longer shared with you\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
d6a21fbb7f0e-0
You can use Amazon EBS and CloudWatch Events to automate your data\-backup workflow\. This requires you to create an IAM policy, a AWS Lambda function to handle the event, and an Amazon CloudWatch Events rule that matches incoming events and routes them to the Lambda function\. The following procedure uses the `createSnapshot` event to automatically copy a completed snapshot to another Region for disaster recovery\. **To copy a completed snapshot to another Region** 1. Create an IAM policy, such as the one shown in the following example, to provide permissions to execute a `CopySnapshot` action and write to the CloudWatch Events log\. Assign the policy to the IAM user that will handle the CloudWatch event\. ``` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "ec2:CopySnapshot" ], "Resource": "*" } ] } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
d6a21fbb7f0e-1
], "Resource": "*" } ] } ``` 1. Define a function in Lambda that will be available from the CloudWatch console\. The sample Lambda function below, written in Node\.js, is invoked by CloudWatch when a matching `createSnapshot` event is emitted by Amazon EBS \(signifying that a snapshot was completed\)\. When invoked, the function copies the snapshot from `us-east-2` to `us-east-1`\. ``` // Sample Lambda function to copy an EBS snapshot to a different region var AWS = require('aws-sdk'); var ec2 = new AWS.EC2(); // define variables var destinationRegion = 'us-east-1'; var sourceRegion = 'us-east-2'; console.log ('Loading function'); //main function exports.handler = (event, context, callback) => { // Get the EBS snapshot ID from the CloudWatch event details var snapshotArn = event.detail.snapshot_id.split('/'); const snapshotId = snapshotArn[1]; const description = `Snapshot copy from ${snapshotId} in ${sourceRegion}.`; console.log ("snapshotId:", snapshotId);
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
d6a21fbb7f0e-2
console.log ("snapshotId:", snapshotId); // Load EC2 class and update the configuration to use destination Region to initiate the snapshot. AWS.config.update({region: destinationRegion}); var ec2 = new AWS.EC2(); // Prepare variables for ec2.modifySnapshotAttribute call const copySnapshotParams = { Description: description, DestinationRegion: destinationRegion, SourceRegion: sourceRegion, SourceSnapshotId: snapshotId }; // Execute the copy snapshot and log any errors ec2.copySnapshot(copySnapshotParams, (err, data) => { if (err) { const errorMessage = `Error copying snapshot ${snapshotId} to Region ${destinationRegion}.`; console.log(errorMessage); console.log(err); callback(errorMessage); } else { const successMessage = `Successfully started copy of snapshot ${snapshotId} to Region ${destinationRegion}.`; console.log(successMessage); console.log(data); callback(null, successMessage); } }); }; ```
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
d6a21fbb7f0e-3
callback(null, successMessage); } }); }; ``` To ensure that your Lambda function is available from the CloudWatch console, create it in the Region where the CloudWatch event will occur\. For more information, see the [AWS Lambda Developer Guide](https://docs.aws.amazon.com/lambda/latest/dg/)\. 1. Open the CloudWatch console at [https://console\.aws\.amazon\.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/)\. 1. Choose **Events**, **Create rule**, **Select event source**, and **Amazon EBS Snapshots**\. 1. For **Specific Event\(s\)**, choose **createSnapshot** and for **Specific Result\(s\)**, choose **succeeded**\. 1. For **Rule target**, find and choose the sample function that you previously created\. 1. Choose **Target**, **Add Target**\. 1. For **Lambda function**, select the Lambda function that you previously created and choose **Configure details**\. 1. On the **Configure rule details** page, type values for **Name** and **Description**\. Select the **State** check box to activate the function \(setting it to **Enabled**\)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
d6a21fbb7f0e-4
1. Choose **Create rule**\. Your rule should now appear on the **Rules** tab\. In the example shown, the event that you configured should be emitted by EBS the next time you copy a snapshot\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/ebs-cloud-watch-events.md
8e7452e7ac04-0
With step scaling policies, you specify CloudWatch alarms to trigger the scaling process\. For example, if you want to scale out when CPU utilization reaches a certain level, create an alarm using the `CPUUtilization` metric provided by Amazon EC2\. When you create a step scaling policy, you must specify one of the following scaling adjustment types: + **Add** – Increase the target capacity of the fleet by a specified number of capacity units or a specified percentage of the current capacity\. + **Remove** – Decrease the target capacity of the fleet by a specified number of capacity units or a specified percentage of the current capacity\. + **Set to** – Set the target capacity of the fleet to the specified number of capacity units\. When an alarm is triggered, the automatic scaling process calculates the new target capacity using the fulfilled capacity and the scaling policy, and then updates the target capacity accordingly\. For example, suppose that the target capacity and fulfilled capacity are 10 and the scaling policy adds 1\. When the alarm is triggered, the automatic scaling process adds 1 to 10 to get 11, so Spot Fleet launches 1 instance\. When a Spot Fleet terminates an instance because the target capacity was decreased, the instance receives a Spot Instance interruption notice\. **Limitation** + The Spot Fleet request must have a request type of `maintain`\. Automatic scaling is not supported for one\-time requests or Spot blocks\. **Prerequisites** + Consider which CloudWatch metrics are important to your application\. You can create CloudWatch alarms based on metrics provided by AWS or your own custom metrics\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/spot-fleet-step-scaling.md
8e7452e7ac04-1
+ Consider which CloudWatch metrics are important to your application\. You can create CloudWatch alarms based on metrics provided by AWS or your own custom metrics\. + For the AWS metrics that you will use in your scaling policies, enable CloudWatch metrics collection if the service that provides the metrics does not enable it by default\. **To create a CloudWatch alarm** 1. Open the CloudWatch console at [https://console\.aws\.amazon\.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/)\. 1. In the navigation pane, choose **Alarms**\. 1. Choose **Create alarm**\. 1. On the **Specify metric and conditions** page, choose **Select metric**\. 1. Choose **EC2 Spot**, **Fleet Request Metrics**, select a metric \(for example, CPUUtilization\), and then choose **Select metric**\. The **Specify metric and conditions** page appears, showing a graph and other information about the metric you selected\. 1. For **Period**, choose the evaluation period for the alarm, for example, 1 minute\. When evaluating the alarm, each period is aggregated into one data point\. **Note** A shorter period creates a more sensitive alarm\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/spot-fleet-step-scaling.md
8e7452e7ac04-2
**Note** A shorter period creates a more sensitive alarm\. 1. For **Conditions**, define the alarm by defining the threshold condition\. For example, you can define a threshold to trigger the alarm whenever the value of the metric is greater than or equal to 80 percent\. 1. Under **Additional configuration**, for **Datapoints to alarm**, specify how many datapoints \(evaluation periods\) must be in the ALARM state to trigger the alarm, for example, 1 evaluation period or 2 out of 3 evaluation periods\. This creates an alarm that goes to ALARM state if that many consecutive periods are breaching\. For more information, see [Evaluating an Alarm](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarm-evaluation) in the *Amazon CloudWatch User Guide*\. 1. For **Missing data treatment**, choose one of the options \(or leave the default of **Treat missing data as missing**\)\. For more information, see [Configuring How CloudWatch Alarms Treat Missing Data](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-and-missing-data) in the *Amazon CloudWatch User Guide*\. 1. Choose **Next**\. 1. \(Optional\) To receive notification of a scaling event, for **Notification**, you can choose or create the Amazon SNS topic you want to use to receive notifications\. Otherwise, you can delete the notification now and add one later as needed\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/spot-fleet-step-scaling.md
8e7452e7ac04-3
1. Choose **Next**\. 1. Under **Add a description**, enter a name and description for the alarm and choose **Next**\. 1. Choose **Create alarm**\. **To configure a step scaling policy for your Spot Fleet \(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 **Spot Requests**\. 1. Select your Spot Fleet request and choose **Auto Scaling**\. 1. If automatic scaling is not configured, choose **Configure**\. 1. Use **Scale capacity between** to set the minimum and maximum capacity for your fleet\. Automatic scaling does not scale your fleet below the minimum capacity or above the maximum capacity\. 1. Initially, **Scaling policies** contains policies named ScaleUp and ScaleDown\. You can complete these policies, or choose **Remove policy** to delete them\. You can also choose **Add policy**\. 1. To define a policy, do the following: 1. For **Policy name**, type a name for the policy\. 1. For **Policy trigger**, select an existing alarm or choose **Create new alarm** to open the Amazon CloudWatch console and create an alarm\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/spot-fleet-step-scaling.md
8e7452e7ac04-4
1. For **Policy trigger**, select an existing alarm or choose **Create new alarm** to open the Amazon CloudWatch console and create an alarm\. 1. For **Modify capacity**, select a scaling adjustment type, select a number, and select a unit\. 1. \(Optional\) To perform step scaling, choose **Define steps**\. By default, an add policy has a lower bound of \-infinity and an upper bound of the alarm threshold\. By default, a remove policy has a lower bound of the alarm threshold and an upper bound of \+infinity\. To add another step, choose **Add step**\. 1. \(Optional\) To modify the default value for the cooldown period, select a number from **Cooldown period**\. 1. Choose **Save**\. **To configure step scaling policies for your Spot Fleet using the AWS CLI** 1. Register the Spot Fleet request as a scalable target using the [register\-scalable\-target](https://docs.aws.amazon.com/cli/latest/reference/application-autoscaling/register-scalable-target.html) command\. 1. Create a scaling policy using the [put\-scaling\-policy](https://docs.aws.amazon.com/cli/latest/reference/application-autoscaling/put-scaling-policy.html) command\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/spot-fleet-step-scaling.md
8e7452e7ac04-5
1. Create an alarm that triggers the scaling policy using the [put\-metric\-alarm](https://docs.aws.amazon.com/cli/latest/reference/cloudwatch/put-metric-alarm.html) command\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/spot-fleet-step-scaling.md
c43d55f1ed2b-0
ClassicLink allows you to link EC2\-Classic instances to a VPC in your account, within the same Region\. If you associate the VPC security groups with a EC2\-Classic instance, this enables communication between your EC2\-Classic instance and instances in your VPC using private IPv4 addresses\. ClassicLink removes the need to make use of public IPv4 addresses or Elastic IP addresses to enable communication between instances in these platforms\. ClassicLink is available to all users with accounts that support the EC2\-Classic platform, and can be used with any EC2\-Classic instance\. For more information about migrating your resources to a VPC, see [Migrating from EC2\-Classic to a VPC](vpc-migrate.md)\. There is no additional charge for using ClassicLink\. Standard charges for data transfer and instance usage apply\. **Topics** + [ClassicLink basics](#classiclink-basics) + [ClassicLink limitations](#classiclink-limitations) + [Working with ClassicLink](#working-with-classiclink) + [Example IAM policies for ClassicLink](#iam-example-classiclink) + [Example: ClassicLink security group configuration for a three\-tier web application](#classiclink-security-groups-example)
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
6f01c3463ace-0
There are two steps to linking an EC2\-Classic instance to a VPC using ClassicLink\. First, you must enable the VPC for ClassicLink\. By default, all VPCs in your account are not enabled for ClassicLink, to maintain their isolation\. After you've enabled the VPC for ClassicLink, you can then link any running EC2\-Classic instance in the same Region in your account to that VPC\. Linking your instance includes selecting security groups from the VPC to associate with your EC2\-Classic instance\. After you've linked the instance, it can communicate with instances in your VPC using their private IP addresses, provided the VPC security groups allow it\. Your EC2\-Classic instance does not lose its private IP address when linked to the VPC\. **Note** Linking your instance to a VPC is sometimes referred to as *attaching* your instance\. A linked EC2\-Classic instance can communicate with instances in a VPC, but it does not form part of the VPC\. If you list your instances and filter by VPC, for example, through the `DescribeInstances` API request, or by using the **Instances** screen in the Amazon EC2 console, the results do not return any EC2\-Classic instances that are linked to the VPC\. For more information about viewing your linked EC2\-Classic instances, see [Viewing your ClassicLink\-enabled VPCs and linked instances](#classiclink-describe-vpcs-instances)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
6f01c3463ace-1
By default, if you use a public DNS hostname to address an instance in a VPC from a linked EC2\-Classic instance, the hostname resolves to the instance's public IP address\. The same occurs if you use a public DNS hostname to address a linked EC2\-Classic instance from an instance in the VPC\. If you want the public DNS hostname to resolve to the private IP address, you can enable ClassicLink DNS support for the VPC\. For more information, see [Enabling ClassicLink DNS support](#classiclink-enable-dns-support)\. If you no longer require a ClassicLink connection between your instance and the VPC, you can unlink the EC2\-Classic instance from the VPC\. This disassociates the VPC security groups from the EC2\-Classic instance\. A linked EC2\-Classic instance is automatically unlinked from a VPC when it's stopped\. After you've unlinked all linked EC2\-Classic instances from the VPC, you can disable ClassicLink for the VPC\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
a45bb145935c-0
Linked EC2\-Classic instances can access the following AWS services in the VPC: Amazon Redshift, Amazon ElastiCache, Elastic Load Balancing, and Amazon RDS\. However, instances in the VPC cannot access the AWS services provisioned by the EC2\-Classic platform using ClassicLink\. If you use Elastic Load Balancing, you can register your linked EC2\-Classic instances with the load balancer\. You must create your load balancer in the ClassicLink\-enabled VPC and enable the Availability Zone in which the instance runs\. If you terminate the linked EC2\-Classic instance, the load balancer deregisters the instance\. If you use Amazon EC2 Auto Scaling, you can create an Amazon EC2 Auto Scaling group with instances that are automatically linked to a specified ClassicLink\-enabled VPC at launch\. For more information, see [Linking EC2\-Classic Instances to a VPC](https://docs.aws.amazon.com/autoscaling/latest/userguide/asg-in-vpc.html#as-ClassicLink) in the *Amazon EC2 Auto Scaling User Guide*\. If you use Amazon RDS instances or Amazon Redshift clusters in your VPC, and they are publicly accessible \(accessible from the Internet\), the endpoint you use to address those resources from a linked EC2\-Classic instance by default resolves to a public IP address\. If those resources are not publicly accessible, the endpoint resolves to a private IP address\. To address a publicly accessible RDS instance or Redshift cluster over private IP using ClassicLink, you must use their private IP address or private DNS hostname, or you must enable ClassicLink DNS support for the VPC\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
a45bb145935c-1
If you use a private DNS hostname or a private IP address to address an RDS instance, the linked EC2\-Classic instance cannot use the failover support available for Multi\-AZ deployments\. You can use the Amazon EC2 console to find the private IP addresses of your Amazon Redshift, Amazon ElastiCache, or Amazon RDS resources\. **To locate the private IP addresses of AWS resources in your VPC** 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 **Network Interfaces**\. 1. Check the descriptions of the network interfaces in the **Description** column\. A network interface that's used by Amazon Redshift, Amazon ElastiCache, or Amazon RDS will have the name of the service in the description\. For example, a network interface that's attached to an Amazon RDS instance will have the following description: `RDSNetworkInterface`\. 1. Select the required network interface\. 1. In the details pane, get the private IP address from the **Primary private IPv4 IP** field\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
b845db5a3bc3-0
By default, IAM users do not have permission to work with ClassicLink\. You can create an IAM policy that grants users permissions to enable or disable a VPC for ClassicLink, link or unlink an instance to a ClassicLink\-enabled VPC, and to view ClassicLink\-enabled VPCs and linked EC2\-Classic instances\. For more information about IAM policies for Amazon EC2, see [IAM policies for Amazon EC2](iam-policies-for-amazon-ec2.md)\. For more information about policies for working with ClassicLink, see the following example: [Example IAM policies for ClassicLink](#iam-example-classiclink)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
da0c6b6789b2-0
Linking your EC2\-Classic instance to a VPC does not affect your EC2\-Classic security groups\. They continue to control all traffic to and from the instance\. This excludes traffic to and from instances in the VPC, which is controlled by the VPC security groups that you associated with the EC2\-Classic instance\. EC2\-Classic instances that are linked to the same VPC cannot communicate with each other through the VPC; regardless of whether they are associated with the same VPC security group\. Communication between EC2\-Classic instances is controlled by the EC2\-Classic security groups associated with those instances\. For an example of a security group configuration, see [Example: ClassicLink security group configuration for a three\-tier web application](#classiclink-security-groups-example)\. After you've linked your instance to a VPC, you cannot change which VPC security groups are associated with the instance\. To associate different security groups with your instance, you must first unlink the instance, and then link it to the VPC again, choosing the required security groups\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
351dc9406125-0
When you enable a VPC for ClassicLink, a static route is added to all of the VPC route tables with a destination of `10.0.0.0/8` and a target of `local`\. This allows communication between instances in the VPC and any EC2\-Classic instances that are then linked to the VPC\. If you add a custom route table to a ClassicLink\-enabled VPC, a static route is automatically added with a destination of `10.0.0.0/8` and a target of `local`\. When you disable ClassicLink for a VPC, this route is automatically deleted in all of the VPC route tables\. VPCs that are in the `10.0.0.0/16` and `10.1.0.0/16` IP address ranges can be enabled for ClassicLink only if they do not have any existing static routes in route tables in the `10.0.0.0/8` IP address range, excluding the local routes that were automatically added when the VPC was created\. Similarly, if you've enabled a VPC for ClassicLink, you may not be able to add any more specific routes to your route tables within the `10.0.0.0/8` IP address range\. **Important**
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
351dc9406125-1
**Important** If your VPC CIDR block is a publicly routable IP address range, consider the security implications before you link an EC2\-Classic instance to your VPC\. For example, if your linked EC2\-Classic instance receives an incoming Denial of Service \(DoS\) request flood attack from a source IP address that falls within the VPC’s IP address range, the response traffic is sent into your VPC\. We strongly recommend that you create your VPC using a private IP address range as specified in [RFC 1918](http://www.faqs.org/rfcs/rfc1918.html)\. For more information about route tables and routing in your VPC, see [Route Tables](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Route_Tables.html) in the *Amazon VPC User Guide*\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
983850d6c0bf-0
If you have a VPC peering connection between two VPCs, and there are one or more EC2\-Classic instances that are linked to one or both of the VPCs via ClassicLink, you can extend the VPC peering connection to enable communication between the EC2\-Classic instances and the instances in the VPC on the other side of the VPC peering connection\. This enables the EC2\-Classic instances and the instances in the VPC to communicate using private IP addresses\. To do this, you can enable a local VPC to communicate with a linked EC2\-Classic instance in a peer VPC, or you can enable a local linked EC2\-Classic instance to communicate with instances in a peer VPC\. If you enable a local VPC to communicate with a linked EC2\-Classic instance in a peer VPC, a static route is automatically added to your route tables with a destination of `10.0.0.0/8` and a target of `local`\. For more information and examples, see [Configurations With ClassicLink](https://docs.aws.amazon.com/vpc/latest/peering/peering-configurations-classiclink.html) in the *Amazon VPC Peering Guide*\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
47ffe11676a9-0
To use the ClassicLink feature, you need to be aware of the following limitations: + You can link an EC2\-Classic instance to only one VPC at a time\. + If you stop your linked EC2\-Classic instance, it's automatically unlinked from the VPC and the VPC security groups are no longer associated with the instance\. You can link your instance to the VPC again after you've restarted it\. + You cannot link an EC2\-Classic instance to a VPC that's in a different Region or a different AWS account\. + You cannot use ClassicLink to link a VPC instance to a different VPC, or to a EC2\-Classic resource\. To establish a private connection between VPCs, you can use a VPC peering connection\. For more information, see the [Amazon VPC Peering Guide](https://docs.aws.amazon.com/vpc/latest/peering/)\. + You cannot associate a VPC Elastic IP address with a linked EC2\-Classic instance\. + You cannot enable EC2\-Classic instances for IPv6 communication\. You can associate an IPv6 CIDR block with your VPC and assign IPv6 address to resources in your VPC, however, communication between a ClassicLinked instance and resources in the VPC is over IPv4 only\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
47ffe11676a9-1
+ VPCs with routes that conflict with the EC2\-Classic private IP address range of `10/8` cannot be enabled for ClassicLink\. This does not include VPCs with `10.0.0.0/16` and `10.1.0.0/16` IP address ranges that already have local routes in their route tables\. For more information, see [Routing for ClassicLink](#classiclink-routing)\. + VPCs configured for dedicated hardware tenancy cannot be enabled for ClassicLink\. Contact AWS support to request that your dedicated tenancy VPC be allowed to be enabled for ClassicLink\. **Important** EC2\-Classic instances are run on shared hardware\. If you've set the tenancy of your VPC to `dedicated` because of regulatory or security requirements, then linking an EC2\-Classic instance to your VPC might not conform to those requirements, as this allows a shared tenancy resource to address your isolated resources directly using private IP addresses\. If you need to enable your dedicated VPC for ClassicLink, provide a detailed reason in your request to AWS support\. + If you link your EC2\-Classic instance to a VPC in the `172.16.0.0/16` range, and you have a DNS server running on the `172.16.0.23/32` IP address within the VPC, then your linked EC2\-Classic instance can't access the VPC DNS server\. To work around this issue, run your DNS server on a different IP address within the VPC\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
47ffe11676a9-2
+ ClassicLink doesn't support transitive relationships out of the VPC\. Your linked EC2\-Classic instance doesn't have access to any VPN connection, VPC gateway endpoint, NAT gateway, or Internet gateway associated with the VPC\. Similarly, resources on the other side of a VPN connection or an Internet gateway don't have access to a linked EC2\-Classic instance\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
bf28325c6ce8-0
You can use the Amazon EC2 and Amazon VPC consoles to work with the ClassicLink feature\. You can enable or disable a VPC for ClassicLink, and link and unlink EC2\-Classic instances to a VPC\. **Note** The ClassicLink features are only visible in the consoles for accounts and regions that support EC2\-Classic\. **Topics** + [Enabling a VPC for ClassicLink](#classiclink-enable-vpc) + [Creating a VPC with ClassicLink enabled](#classiclink-vpc-wizard) + [Linking an instance to a VPC](#classiclink-link-instance) + [Linking an instance to a VPC at launch](#classiclink-launch-wizard) + [Viewing your ClassicLink\-enabled VPCs and linked instances](#classiclink-describe-vpcs-instances) + [Enabling ClassicLink DNS support](#classiclink-enable-dns-support) + [Disabling ClassicLink DNS support](#classiclink-disable-dns-support) + [Unlinking an instance from a VPC](#classiclink-unlink-instance) + [Disabling ClassicLink for a VPC](#classiclink-disable-vpc)
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
eee296d4e2e4-0
To link an EC2\-Classic instance to a VPC, you must first enable the VPC for ClassicLink\. You cannot enable a VPC for ClassicLink if the VPC has routing that conflicts with the EC2\-Classic private IP address range\. For more information, see [Routing for ClassicLink](#classiclink-routing)\. **To enable a VPC for ClassicLink** 1. Open the Amazon VPC console at [https://console\.aws\.amazon\.com/vpc/](https://console.aws.amazon.com/vpc/)\. 1. In the navigation pane, choose **Your VPCs**\. 1. Choose a VPC, and then choose **Actions**, **Enable ClassicLink**\. 1. In the confirmation dialog box, choose **Yes, Enable**\. 1. \(Optional\) If you want the public DNS hostname to resolve to the private IP address, enable ClassicLink DNS support for the VPC before you link any instances\. For more information, see [Enabling ClassicLink DNS support](#classiclink-enable-dns-support)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
31fafc84b512-0
You can create a new VPC and immediately enable it for ClassicLink by using the VPC wizard in the Amazon VPC console\. **To create a VPC with ClassicLink enabled** 1. Open the Amazon VPC console at [https://console\.aws\.amazon\.com/vpc/](https://console.aws.amazon.com/vpc/)\. 1. From the Amazon VPC dashboard, choose **Start VPC Wizard**\. 1. Select one of the VPC configuration options and choose **Select**\. 1. On the next page of the wizard, choose **Yes** for **Enable ClassicLink**\. Complete the rest of the steps in the wizard to create your VPC\. For more information about using the VPC wizard, see [Scenarios for Amazon VPC](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Scenarios.html) in the *Amazon VPC User Guide*\. 1. \(Optional\) If you want the public DNS hostname to resolve to the private IP address, enable ClassicLink DNS support for the VPC before you link any instances\. For more information, see [Enabling ClassicLink DNS support](#classiclink-enable-dns-support)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
917263b311c5-0
After you've enabled a VPC for ClassicLink, you can link an EC2\-Classic instance to it\. **Note** You can only link a running EC2\-Classic instance to a VPC\. You cannot link an instance that's in the `stopped` state\. If you want the public DNS hostname to resolve to the private IP address, enable ClassicLink DNS support for the VPC before you link the instance\. For more information, see [Enabling ClassicLink DNS support](#classiclink-enable-dns-support)\. **To link an instance to a VPC** 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 running EC2\-Classic instance, choose **Actions**, **ClassicLink**, **Link to VPC**\. You can select more than one instance to link to the same VPC\. 1. In the dialog box that displays, select a VPC from the list\. Only VPCs that have been enabled for ClassicLink are displayed\. 1. Select one or more of the VPC security groups to associate with your instance\. When you are done, choose **Link to VPC**\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
b38ddf6b1396-0
You can use the launch wizard in the Amazon EC2 console to launch an EC2\-Classic instance and immediately link it to a ClassicLink\-enabled VPC\. **To link an instance to a VPC at launch** 1. Open the Amazon EC2 console at [https://console\.aws\.amazon\.com/ec2/](https://console.aws.amazon.com/ec2/)\. 1. From the Amazon EC2 dashboard, choose **Launch Instance**\. 1. Select an AMI, and then choose an instance type\. On the **Configure Instance Details** page, ensure that you select **Launch into EC2\-Classic** from the **Network** list\. **Note** Some instance types, such as T2 instance types, can only be launched into a VPC\. Ensure that you select an instance type that can be launched into EC2\-Classic\. 1. In the **Link to VPC \(ClassicLink\)** section, select a VPC from **Link to VPC**\. Only ClassicLink\-enabled VPCs are displayed\. Select the security groups from the VPC to associate with the instance\. Complete the other configuration options on the page, and then complete the rest of the steps in the wizard to launch your instance\. For more information about using the launch wizard, see [Launching an instance using the Launch Instance Wizard](launching-instance.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
6f51e32c2a99-0
You can view all of your ClassicLink\-enabled VPCs in the Amazon VPC console, and your linked EC2\-Classic instances in the Amazon EC2 console\. **To view your ClassicLink\-enabled VPCs** 1. Open the Amazon VPC console at [https://console\.aws\.amazon\.com/vpc/](https://console.aws.amazon.com/vpc/)\. 1. In the navigation pane, choose **Your VPCs**\. 1. Select a VPC, and in the **Summary** tab, look for the **ClassicLink** field\. A value of **Enabled** indicates that the VPC is enabled for ClassicLink\. 1. Alternatively, look for the **ClassicLink** column, and view the value that's displayed for each VPC \(**Enabled** or **Disabled**\)\. If the column is not visible, choose **Edit Table Columns** \(the gear\-shaped icon\), select the **ClassicLink** attribute, and then choose **Close**\. **To view your linked EC2\-Classic instances** 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**\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
6f51e32c2a99-1
1. In the navigation pane, choose **Instances**\. 1. Select an EC2\-Classic instance, and in the **Description** tab, look for the **ClassicLink** field\. If the instance is linked to a VPC, the field displays the ID of the VPC to which the instance is linked\. If the instance is not linked to any VPC, the field displays **Unlinked**\. 1. Alternatively, you can filter your instances to display only linked EC2\-Classic instances for a specific VPC or security group\. In the search bar, start typing `ClassicLink`, select the relevant ClassicLink resource attribute, and then select the security group ID or the VPC ID\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
1bd35661d9ed-0
You can enable ClassicLink DNS support for your VPC so that DNS hostnames that are addressed between linked EC2\-Classic instances and instances in the VPC resolve to private IP addresses and not public IP addresses\. For this feature to work, your VPC must be enabled for DNS hostnames and DNS resolution\. **Note** If you enable ClassicLink DNS support for your VPC, your linked EC2\-Classic instance can access any private hosted zone associated with the VPC\. For more information, see [Working with Private Hosted Zones](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/hosted-zones-private.html) in the *Amazon Route 53 Developer Guide*\. **To enable ClassicLink DNS support** 1. Open the Amazon VPC console at [https://console\.aws\.amazon\.com/vpc/](https://console.aws.amazon.com/vpc/)\. 1. In the navigation pane, choose **Your VPCs**\. 1. Select your VPC, and choose **Actions**, **Edit ClassicLink DNS Support**\. 1. For **ClassicLink DNS Support**, choose **Enable**, and then choose **Save**\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
649d74a7aa0a-0
You can disable ClassicLink DNS support for your VPC so that DNS hostnames that are addressed between linked EC2\-Classic instances and instances in the VPC resolve to public IP addresses and not private IP addresses\. **To disable ClassicLink DNS support** 1. Open the Amazon VPC console at [https://console\.aws\.amazon\.com/vpc/](https://console.aws.amazon.com/vpc/)\. 1. In the navigation pane, choose **Your VPCs**\. 1. Select your VPC, and choose **Actions**, **Edit ClassicLink DNS Support**\. 1. For **ClassicLink DNS Support**, clear the **Enable** check box, and then choose **Save**\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
2fd3916eb16d-0
If you no longer require a ClassicLink connection between your EC2\-Classic instance and your VPC, you can unlink the instance from the VPC\. Unlinking the instance disassociates the VPC security groups from the instance\. **Note** A stopped instance is automatically unlinked from a VPC\. **To unlink an instance from a VPC** 1. Open the Amazon EC2 console at [https://console\.aws\.amazon\.com/ec2/](https://console.aws.amazon.com/ec2/)\. 1. In the navigation pane, choose **Instances**, and select your instance\. 1. In the **Actions** list, select **ClassicLink**, **Unlink Instance**\. You can select more than one instance to unlink from the same VPC\. 1. Choose **Yes** in the confirmation dialog box\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
044a8225b309-0
If you no longer require a connection between EC2\-Classic instances and your VPC, you can disable ClassicLink on the VPC\. You must first unlink all linked EC2\-Classic instances that are linked to the VPC\. **To disable ClassicLink for a VPC** 1. Open the Amazon VPC console at [https://console\.aws\.amazon\.com/vpc/](https://console.aws.amazon.com/vpc/)\. 1. In the navigation pane, choose **Your VPCs**\. 1. Select your VPC, then choose **Actions**, **Disable ClassicLink**\. 1. In the confirmation dialog box, choose **Yes, Disable**\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
b26a980e0f22-0
You can enable a VPC for ClassicLink and then link an EC2\-Classic instance to the VPC\. You can also view your ClassicLink\-enabled VPCs, and all of your EC2\-Classic instances that are linked to a VPC\. You can create policies with resource\-level permission for the `ec2:EnableVpcClassicLink`, `ec2:DisableVpcClassicLink`, `ec2:AttachClassicLinkVpc`, and `ec2:DetachClassicLinkVpc` actions to control how users are able to use those actions\. Resource\-level permissions are not supported for `ec2:Describe*` actions\. **Topics** + [Full permissions to work with ClassicLink](#iam-example-classiclink-full) + [Enable and disable a VPC for ClassicLink](#iam-example-classiclink-enable) + [Link instances](#iam-example-classiclink-link) + [Unlink instances](#iam-example-classiclink-unlink)
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
7bb507b2d38d-0
The following policy grants users permissions to view ClassicLink\-enabled VPCs and linked EC2\-Classic instances, to enable and disable a VPC for ClassicLink, and to link and unlink instances from a ClassicLink\-enabled VPC\. ``` { "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": [ "ec2:DescribeClassicLinkInstances", "ec2:DescribeVpcClassicLink", "ec2:EnableVpcClassicLink", "ec2:DisableVpcClassicLink", "ec2:AttachClassicLinkVpc", "ec2:DetachClassicLinkVpc" ], "Resource": "*" } ] } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
8df3dfb55579-0
The following policy allows user to enable and disable VPCs for ClassicLink that have the specific tag '`purpose=classiclink`'\. Users cannot enable or disable any other VPCs for ClassicLink\. ``` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "ec2:*VpcClassicLink", "Resource": "arn:aws:ec2:region:account:vpc/*", "Condition": { "StringEquals": { "ec2:ResourceTag/purpose":"classiclink" } } } ] } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
94e920cb0995-0
The following policy grants users permissions to link instances to a VPC only if the instance is an `m3.large` instance type\. The second statement allows users to use the VPC and security group resources, which are required to link an instance to a VPC\. ``` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "ec2:AttachClassicLinkVpc", "Resource": "arn:aws:ec2:region:account:instance/*", "Condition": { "StringEquals": { "ec2:InstanceType":"m3.large" } } }, { "Effect": "Allow", "Action": "ec2:AttachClassicLinkVpc", "Resource": [ "arn:aws:ec2:region:account:vpc/*", "arn:aws:ec2:region:account:security-group/*" ] } ] } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
94e920cb0995-1
] } ] } ``` The following policy grants users permissions to link instances to a specific VPC \(`vpc-1a2b3c4d`\) only, and to associate only specific security groups from the VPC to the instance \(`sg-1122aabb` and `sg-aabb2233`\)\. Users cannot link an instance to any other VPC, and they cannot specify any other of the VPC security groups to associate with the instance in the request\. ``` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "ec2:AttachClassicLinkVpc", "Resource": [ "arn:aws:ec2:region:account:vpc/vpc-1a2b3c4d", "arn:aws:ec2:region:account:instance/*", "arn:aws:ec2:region:account:security-group/sg-1122aabb", "arn:aws:ec2:region:account:security-group/sg-aabb2233" ] } ] } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
f55f1f8f1e28-0
The following grants users permission to unlink any linked EC2\-Classic instance from a VPC, but only if the instance has the tag "`unlink=true`"\. The second statement grants users permissions to use the VPC resource, which is required to unlink an instance from a VPC\. ``` { "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": "ec2:DetachClassicLinkVpc", "Resource": [ "arn:aws:ec2:region:account:instance/*" ], "Condition": { "StringEquals": { "ec2:ResourceTag/unlink":"true" } } }, { "Effect": "Allow", "Action": "ec2:DetachClassicLinkVpc", "Resource": [ "arn:aws:ec2:region:account:vpc/*" ] } ] } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
5f2e22dad3f0-0
In this example, you have an application with three instances: a public\-facing web server, an application server, and a database server\. Your web server accepts HTTPS traffic from the Internet, and then communicates with your application server over TCP port 6001\. Your application server then communicates with your database server over TCP port 6004\. You're in the process of migrating your entire application to a VPC in your account\. You've already migrated your application server and your database server to your VPC\. Your web server is still in EC2\-Classic and linked to your VPC via ClassicLink\. You want a security group configuration that allows traffic to flow only between these instances\. You have four security groups: two for your web server \(`sg-1a1a1a1a` and `sg-2b2b2b2b`\), one for your application server \(`sg-3c3c3c3c`\), and one for your database server \(`sg-4d4d4d4d`\)\. The following diagram displays the architecture of your instances, and their security group configuration\. ![\[Security group configuration using ClassicLink.\]](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/images/classiclink-security-groups-example-diagram.png) **Security groups for your web server \(`sg-1a1a1a1a` and `sg-2b2b2b2b`\)**
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
5f2e22dad3f0-1
**Security groups for your web server \(`sg-1a1a1a1a` and `sg-2b2b2b2b`\)** You have one security group in EC2\-Classic, and the other in your VPC\. You associated the VPC security group with your web server instance when you linked the instance to your VPC via ClassicLink\. The VPC security group enables you to control the outbound traffic from your web server to your application server\. The following are the security group rules for the EC2\-Classic security group \(`sg-1a1a1a1a`\)\. | | | Inbound | | --- | | Source | Type | Port Range | Comments | | 0\.0\.0\.0/0 | HTTPS | 443 | Allows Internet traffic to reach your web server\. | The following are the security group rules for the VPC security group \(`sg-2b2b2b2b`\)\. | | | Outbound | | --- | | Destination | Type | Port Range | Comments | | sg\-3c3c3c3c | TCP | 6001 | Allows outbound traffic from your web server to your application server in your VPC \(or to any other instance associated with `sg-3c3c3c3c`\)\. | **Security group for your application server \(`sg-3c3c3c3c`\)**
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
5f2e22dad3f0-2
**Security group for your application server \(`sg-3c3c3c3c`\)** The following are the security group rules for the VPC security group that's associated with your application server\. | | | Inbound | | --- | | Source | Type | Port Range | Comments | | sg\-2b2b2b2b | TCP | 6001 | Allows the specified type of traffic from your web server \(or any other instance associated with `sg-2b2b2b2b`\) to reach your application server\. | | Outbound | | --- | | Destination | Type | Port Range | Comments | | sg\-4d4d4d4d | TCP | 6004 | Allows outbound traffic from the application server to the database server \(or to any other instance associated with sg\-4d4d4d4d\)\. | **Security group for your database server \(`sg-4d4d4d4d`\)** The following are the security group rules for the VPC security group that's associated with your database server\. | | | Inbound | | --- | | Source | Type | Port Range | Comments |
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
5f2e22dad3f0-3
| | | Inbound | | --- | | Source | Type | Port Range | Comments | | sg\-3c3c3c3c | TCP | 6004 | Allows the specified type of traffic from your application server \(or any other instance associated with `sg-3c3c3c3c`\) to reach your database server\. |
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/vpc-classiclink.md
ad7fe9d8e6f3-0
The following examples explain credit use when instances are configured as `standard`\. **Topics** + [Example 1: Explaining credit use with T3 Standard](#t3_standard_example) + [Example 2: Explaining credit use with T2 Standard](#t2-standard-example)
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/standard-mode-examples.md
8d49e15bf471-0
In this example, you see how a `t3.nano` instance launched as `standard` earns, accrues, and spends *earned* credits\. You see how the credit balance reflects the accrued *earned* credits\. A running `t3.nano` instance earns 144 credits every 24 hours\. Its credit balance limit is 144 earned credits\. After the limit is reached, new credits that are earned are discarded\. For more information about the number of credits that can be earned and accrued, see the [credit table](burstable-credits-baseline-concepts.md#burstable-performance-instances-credit-table)\. You might launch a T3 Standard instance and use it immediately\. Or, you might launch a T3 Standard instance and leave it idle for a few days before running applications on it\. Whether an instance is used or remains idle determines if credits are spent or accrued\. If an instance remains idle for 24 hours from the time it is launched, the credit balance reaches it limit, which is the maximum number of earned credits that can be accrued\. This example describes an instance that remains idle for 24 hours from the time it is launched, and walks you through seven periods of time over a 96\-hour period, showing the rate at which credits are earned, accrued, spent, and discarded, and the value of the credit balance at the end of each period\. The following workflow references the numbered points on the graph:
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/standard-mode-examples.md
8d49e15bf471-1
The following workflow references the numbered points on the graph: **P1** – At 0 hours on the graph, the instance is launched as `standard` and immediately begins to earn credits\. The instance remains idle from the time it is launched—CPU utilization is 0%—and no credits are spent\. All unspent credits are accrued in the credit balance\. For the first 24 hours, `CPUCreditUsage` is at 0, and the `CPUCreditBalance` value reaches its maximum of 144\. **P2** – For the next 12 hours, CPU utilization is at 2\.5%, which is below the 5% baseline\. The instance earns more credits than it spends, but the `CPUCreditBalance` value cannot exceed its maximum of 144 credits\. Any credits that are earned in excess of the limit are discarded\. **P3** – For the next 24 hours, CPU utilization is at 7% \(above the baseline\), which requires a spend of 57\.6 credits\. The instance spends more credits than it earns, and the `CPUCreditBalance` value reduces to 86\.4 credits\. **P4** – For the next 12 hours, CPU utilization decreases to 2\.5% \(below the baseline\), which requires a spend of 36 credits\. In the same time, the instance earns 72 credits\. The instance earns more credits than it spends, and the `CPUCreditBalance` value increases to 122 credits\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/standard-mode-examples.md
8d49e15bf471-2
**P5** – For the next two hours, the instance bursts at 100% CPU utilization, and depletes its entire `CPUCreditBalance` value of 122 credits\. At the end of this period, with the `CPUCreditBalance` at zero, CPU utilization is forced to drop to the baseline utilization level of 5%\. At the baseline, the instance earns as many credits as it spends\. **P6** – For the next 14 hours, CPU utilization is at 5% \(the baseline\)\. The instance earns as many credits as it spends\. The `CPUCreditBalance` value remains at 0\. **P7** – For the last 24 hours in this example, the instance is idle and CPU utilization is 0%\. During this time, the instance earns 144 credits, which it accrues in its `CPUCreditBalance`\. ![\[Image NOT FOUND\]](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/images/t3_standard_graph.png)
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/standard-mode-examples.md
ac09c5239c8e-0
In this example, you see how a `t2.nano` instance launched as `standard` earns, accrues, and spends *launch* and *earned* credits\. You see how the credit balance reflects not only accrued *earned* credits, but also accrued *launch* credits\. A `t2.nano` instance gets 30 launch credits when it is launched, and earns 72 credits every 24 hours\. Its credit balance limit is 72 earned credits; launch credits do not count towards the limit\. After the limit is reached, new credits that are earned are discarded\. For more information about the number of credits that can be earned and accrued, see the [credit table](burstable-credits-baseline-concepts.md#burstable-performance-instances-credit-table)\. For more information about limits, see [Launch credit limits](burstable-performance-instances-standard-mode-concepts.md#launch-credit-limits)\. You might launch a T2 Standard instance and use it immediately\. Or, you might launch a T2 Standard instance and leave it idle for a few days before running applications on it\. Whether an instance is used or remains idle determines if credits are spent or accrued\. If an instance remains idle for 24 hours from the time it is launched, the credit balance appears to exceed its limit because the balance reflects both accrued earned credits and accrued launch credits\. However, after CPU is used, the launch credits are spent first\. Thereafter, the limit always reflects the maximum number of earned credits that can be accrued\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/standard-mode-examples.md
ac09c5239c8e-1
This example describes an instance that remains idle for 24 hours from the time it is launched, and walks you through seven periods of time over a 96\-hour period, showing the rate at which credits are earned, accrued, spent, and discarded, and the value of the credit balance at the end of each period\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/standard-mode-examples.md
db5f69db37c9-0
At 0 hours on the graph, the T2 instance is launched as `standard` and immediately gets 30 launch credits\. It earns credits while in the running state\. The instance remains idle from the time it is launched—CPU utilization is 0%—and no credits are spent\. All unspent credits are accrued in the credit balance\. At approximately 14 hours after launch, the credit balance is 72 \(30 launch credits \+ 42 earned credits\), which is equivalent to what the instance can earn in 24 hours\. At 24 hours after launch, the credit balance exceeds 72 credits because the unspent launch credits are accrued in the credit balance—the credit balance is 102 credits: 30 launch credits \+ 72 earned credits\. ![\[Image NOT FOUND\]](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/images/t2-graph1.png) | | | | --- |--- | | Credit Spend Rate | 0 credits per 24 hours \(0% CPU utilization\) | | Credit Earn Rate | 72 credits per 24 hours | | Credit Discard Rate | 0 credits per 24 hours | | Credit Balance | 102 credits \(30 launch credits \+ 72 earned credits\) | **Conclusion** If there is no CPU utilization after launch, the instance accrues more credits than what it can earn in 24 hours \(30 launch credits \+ 72 earned credits = 102 credits\)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/standard-mode-examples.md
db5f69db37c9-1
In a real\-world scenario, an EC2 instance consumes a small number of credits while launching and running, which prevents the balance from reaching the maximum theoretical value in this example\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/standard-mode-examples.md
aaeae5c852fe-0
For the next 12 hours, the instance continues to remain idle and earn credits, but the credit balance does not increase\. It plateaus at 102 credits \(30 launch credits \+ 72 earned credits\)\. The credit balance has reached its limit of 72 accrued earned credits, so newly earned credits are discarded\. ![\[Image NOT FOUND\]](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/images/t2-graph2.png) | | | | --- |--- | | Credit Spend Rate | 0 credits per 24 hours \(0% CPU utilization\) | | Credit Earn Rate | 72 credits per 24 hours \(3 credits per hour\) | | Credit Discard Rate | 72 credits per 24 hours \(100% of credit earn rate\) | | Credit Balance | 102 credits \(30 launch credits \+ 72 earned credits\)—balance is unchanged | **Conclusion** An instance constantly earns credits, but it cannot accrue more earned credits if the credit balance has reached its limit\. After the limit is reached, newly earned credits are discarded\. Launch credits do not count towards the credit balance limit\. If the balance includes accrued launch credits, the balance appears to be over the limit\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/standard-mode-examples.md
8c6c872dd6ed-0
For the next 25 hours, the instance uses 2% CPU, which requires 30 credits\. In the same period, it earns 75 credits, but the credit balance decreases\. The balance decreases because the accrued *launch* credits are spent first, while newly earned credits are discarded because the credit balance is already at its limit of 72 earned credits\. ![\[Image NOT FOUND\]](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/images/t2-graph3.png) | | | | --- |--- | | Credit Spend Rate | 28\.8 credits per 24 hours \(1\.2 credits per hour, 2% CPU utilization, 40% of credit earn rate\)—30 credits over 25 hours | | Credit Earn Rate | 72 credits per 24 hours | | Credit Discard Rate | 72 credits per 24 hours \(100% of credit earn rate\) | | Credit Balance | 72 credits \(30 launch credits were spent; 72 earned credits remain unspent\) | **Conclusion** An instance spends launch credits first, before spending earned credits\. Launch credits do not count towards the credit limit\. After the launch credits are spent, the balance can never go higher than what can be earned in 24 hours\. Furthermore, while an instance is running, it cannot get more launch credits\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/standard-mode-examples.md
26b4d74a3c81-0
For the next 11 hours, the instance uses 2% CPU, which requires 13\.2 credits\. This is the same CPU utilization as in the previous period, but the balance does not decrease\. It stays at 72 credits\. The balance does not decrease because the credit earn rate is higher than the credit spend rate\. In the time that the instance spends 13\.2 credits, it also earns 33 credits\. However, the balance limit is 72 credits, so any earned credits that exceed the limit are discarded\. The balance plateaus at 72 credits, which is different from the plateau of 102 credits during Period 2, because there are no accrued launch credits\. ![\[Image NOT FOUND\]](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/images/t2-graph4.png) | | | | --- |--- | | Credit Spend Rate | 28\.8 credits per 24 hours \(1\.2 credits per hour, 2% CPU utilization, 40% of credit earn rate\)—13\.2 credits over 11 hours | | Credit Earn Rate | 72 credits per 24 hours | | Credit Discard Rate | 43\.2 credits per 24 hours \(60% of credit earn rate\) | | Credit Balance | 72 credits \(0 launch credits, 72 earned credits\)—balance is at its limit | **Conclusion** After launch credits are spent, the credit balance limit is determined by the number of credits that an instance can earn in 24 hours\. If the instance earns more credits than it spends, newly earned credits over the limit are discarded\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/standard-mode-examples.md
ce3e2860ad12-0
For the next three hours, the instance bursts at 20% CPU utilization, which requires 36 credits\. The instance earns nine credits in the same three hours, which results in a net balance decrease of 27 credits\. At the end of three hours, the credit balance is 45 accrued earned credits\. ![\[Image NOT FOUND\]](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/images/t2-graph5.png) | | | | --- |--- | | Credit Spend Rate | 288 credits per 24 hours \(12 credits per hour, 20% CPU utilization, 400% of credit earn rate\)—36 credits over 3 hours | | Credit Earn Rate | 72 credits per 24 hours \(9 credits over 3 hours\) | | Credit Discard Rate | 0 credits per 24 hours | | Credit Balance | 45 credits \(previous balance \(72\) \- spent credits \(36\) \+ earned credits \(9\)\)—balance decreases at a rate of 216 credits per 24 hours \(spend rate 288/24 \+ earn rate 72/24 = balance decrease rate 216/24\) | **Conclusion** If an instance spends more credits than it earns, its credit balance decreases\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/standard-mode-examples.md
6671748fad46-0
For the next 15 hours, the instance uses 2% CPU, which requires 18 credits\. This is the same CPU utilization as in Periods 3 and 4\. However, the balance increases in this period, whereas it decreased in Period 3 and plateaued in Period 4\. In Period 3, the accrued launch credits were spent, and any earned credits that exceeded the credit limit were discarded, resulting in a decrease in the credit balance\. In Period 4, the instance spent fewer credits than it earned\. Any earned credits that exceeded the limit were discarded, so the balance plateaued at its maximum of 72 credits\. In this period, there are no accrued launch credits, and the number of accrued earned credits in the balance is below the limit\. No earned credits are discarded\. Furthermore, the instance earns more credits than it spends, resulting in an increase in the credit balance\. ![\[Image NOT FOUND\]](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/images/t2-graph6.png) | | | | --- |--- | | Credit Spend Rate | 28\.8 credits per 24 hours \(1\.2 credits per hour, 2% CPU utilization, 40% of credit earn rate\)—18 credits over 15 hours | | Credit Earn Rate | 72 credits per 24 hours \(45 credits over 15 hours\) | | Credit Discard Rate | 0 credits per 24 hours | | Credit Balance | 72 credits \(balance increases at a rate of 43\.2 credits per 24 hours—change rate = spend rate 28\.8/24 \+ earn rate 72/24\) |
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/standard-mode-examples.md
6671748fad46-1
**Conclusion** If an instance spends fewer credits than it earns, its credit balance increases\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/standard-mode-examples.md
ba8113fa4d89-0
For the next six hours, the instance remains idle—CPU utilization is 0%—and no credits are spent\. This is the same CPU utilization as in Period 2, but the balance does not plateau at 102 credits—it plateaus at 72 credits, which is the credit balance limit for the instance\. In Period 2, the credit balance included 30 accrued launch credits\. The launch credits were spent in Period 3\. A running instance cannot get more launch credits\. After its credit balance limit is reached, any earned credits that exceed the limit are discarded\. ![\[Image NOT FOUND\]](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/images/t2-graph7.png) | | | | --- |--- | | Credit Spend Rate | 0 credits per 24 hours \(0% CPU utilization\) | | Credit Earn Rate | 72 credits per 24 hours | | Credit Discard Rate | 72 credits per 24 hours \(100% of credit earn rate\) | | Credit Balance | 72 credits \(0 launch credits, 72 earned credits\) | **Conclusion** An instance constantly earns credits, but cannot accrue more earned credits if the credit balance limit has been reached\. After the limit is reached, newly earned credits are discarded\. The credit balance limit is determined by the number of credits that an instance can earn in 24 hours\. For more information about credit balance limits, see the [credit table](burstable-credits-baseline-concepts.md#burstable-performance-instances-credit-table)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/standard-mode-examples.md
eee9e1085f31-0
To help you understand the charges for your Spot Instances, Amazon EC2 provides a data feed that describes your Spot Instance usage and pricing\. This data feed is sent to an Amazon S3 bucket that you specify when you subscribe to the data feed\. Data feed files arrive in your bucket typically once an hour, and each hour of usage is typically covered in a single data file\. These files are compressed \(gzip\) before they are delivered to your bucket\. Amazon EC2 can write multiple files for a given hour of usage where files are large \(for example, when file contents for the hour exceed 50 MB before compression\)\. **Note** If you don't have a Spot Instance running during a certain hour, you don't receive a data feed file for that hour\. **Topics** + [Data feed file name and format](#using-spot-instances-format) + [Amazon S3 bucket requirements](#using-spot-instances-dfs3) + [Subscribing to your Spot Instance data feed](#using-spot-instances-datafeed-all) + [Deleting your Spot Instance data feed](#using-spot-instances-datafeed-delete)
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/spot-data-feeds.md
fdb1702f3aa4-0
The Spot Instance data feed file name uses the following format \(with the date and hour in UTC\): ``` bucket-name.s3.amazonaws.com/optional-prefix/aws-account-id.YYYY-MM-DD-HH.n.unique-id.gz ``` For example, if your bucket name is **my\-bucket\-name** and your prefix is **my\-prefix**, your file names are similar to the following: ``` my-bucket-name.s3.amazonaws.com/my-prefix/111122223333.2019-03-17-20.001.pwBdGTJG.gz ``` For more information about bucket names, see [Rules for bucket naming](https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html#bucketnamingrules) in the *Amazon Simple Storage Service Developer Guide*\. The Spot Instance data feed files are tab\-delimited\. Each line in the data file corresponds to one instance hour and contains the fields listed in the following table\. | Field | Description | | --- | --- | | `Timestamp` | The timestamp used to determine the price charged for this instance usage\. |
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/spot-data-feeds.md
fdb1702f3aa4-1
| --- | --- | | `Timestamp` | The timestamp used to determine the price charged for this instance usage\. | | `UsageType` | The type of usage and instance type being charged for\. For `m1.small` Spot Instances, this field is set to `SpotUsage`\. For all other instance types, this field is set to `SpotUsage:`\{*instance\-type*\}\. For example, `SpotUsage:c1.medium`\. | | `Operation` | The product being charged for\. For Linux Spot Instances, this field is set to `RunInstances`\. For Windows Spot Instances, this field is set to `RunInstances:0002`\. Spot usage is grouped according to Availability Zone\. | | `InstanceID` | The ID of the Spot Instance that generated this instance usage\. | | `MyBidID` | The ID for the Spot Instance request that generated this instance usage\. | | `MyMaxPrice` | The maximum price specified for this Spot Instance request\. | | `MarketPrice` | The Spot price at the time specified in the `Timestamp` field\. | | `Charge` | The price charged for this instance usage\. | | `Version` | The version included in the data feed file name for this record\. |
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/spot-data-feeds.md
3b37b9207791-0
When you subscribe to the data feed, you must specify an Amazon S3 bucket to store the data feed files\. Before you choose an Amazon S3 bucket for the data feed, consider the following: + You must have `FULL_CONTROL` permission to the bucket, which includes permission for the `s3:GetBucketAcl` and `s3:PutBucketAcl` actions\. If you're the bucket owner, you have this permission by default\. Otherwise, the bucket owner must grant your AWS account this permission\. + When you subscribe to a data feed, these permissions are used to update the bucket ACL to give the AWS data feed account `FULL_CONTROL` permission\. The AWS data feed account writes data feed files to the bucket\. If your account doesn't have the required permissions, the data feed files cannot be written to the bucket\. **Note** If you update the ACL and remove the permissions for the AWS data feed account, the data feed files cannot be written to the bucket\. You must resubscribe to the data feed to receive the data feed files\. + Each data feed file has its own ACL \(separate from the ACL for the bucket\)\. The bucket owner has `FULL_CONTROL` permission to the data files\. The AWS data feed account has read and write permissions\. + If you delete your data feed subscription, Amazon EC2 doesn't remove the read and write permissions for the AWS data feed account on either the bucket or the data files\. You must remove these permissions yourself\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/spot-data-feeds.md
b0e2f5da848e-0
To subscribe to your data feed, use the [create\-spot\-datafeed\-subscription](https://docs.aws.amazon.com/cli/latest/reference/ec2/create-spot-datafeed-subscription.html) command\. ``` aws ec2 create-spot-datafeed-subscription \ --bucket my-bucket-name \ [--prefix my-prefix] ``` The following is example output: ``` { "SpotDatafeedSubscription": { "OwnerId": "111122223333", "Bucket": "my-bucket-name", "Prefix": "my-prefix", "State": "Active" } } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/spot-data-feeds.md
218749cd486b-0
To delete your data feed, use the [delete\-spot\-datafeed\-subscription](https://docs.aws.amazon.com/cli/latest/reference/ec2/delete-spot-datafeed-subscription.html) command\. ``` aws ec2 delete-spot-datafeed-subscription ```
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/spot-data-feeds.md
608f970073c3-0
Inf1 instances are designed to accelerate machine learning using AWS Inferentia, a custom AI/ML chip from Amazon that provides high performance and low latency machine learning inference\. These instances are optimized for deploying Deep Learning \(DL\) models for applications, such as natural language processing, object detection and classification, content personalization and filtering, and speech recognition\. **Getting started** There are a variety of ways that you can get started\. + Use SageMaker, a fully\-managed service that is the easiest way to get started with machine learning models\. For more information, see [Compile and deploy a TensorFlow model on Inf1 instances](https://github.com/awslabs/amazon-sagemaker-examples/blob/master/sagemaker_neo_compilation_jobs/deploy_tensorflow_model_on_Inf1_instance/tensorflow_distributed_mnist_neo_inf1.ipynb) on github\. + Launch an Inf1 instance using the Deep Learning AMI\. For more information, see [AWS Inferentia with DLAMI](https://docs.aws.amazon.com/dlami/latest/devguide/tutorial-inferentia.html) in the *AWS Deep Learning AMI Developer Guide*\. + Launch an Inf1 instance using your own AMI and install the [AWS Neuron SDK](https://github.com/aws/aws-neuron-sdk), which enables you to compile, run, and profile deep learning models for AWS Inferentia\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/inf-getting-started.md
608f970073c3-1
+ Launch a container instance using an Inf1 instance and an Amazon ECS\-optimized AMI\. For more information, see [Amazon Linux 2 \(Inferentia\) AMIs](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html) in the *Amazon Elastic Container Service Developer Guide*\. + Create an Amazon EKS cluster with nodes running Inf1 instances\. For more information, see [Inferentia support](https://docs.aws.amazon.com/eks/latest/userguide/inferentia-support.html) in the **Amazon EKS User Guide**\. **Learn more** + [AWS Inferentia](http://aws.amazon.com/machine-learning/inferentia/) + [AWS Neuron](http://aws.amazon.com/machine-learning/neuron/) + [Machine Learning on AWS](http://aws.amazon.com/machine-learning/)
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/inf-getting-started.md
60521712cf12-0
With Amazon EBS, you can use any of the standard RAID configurations that you can use with a traditional bare metal server, as long as that particular RAID configuration is supported by the operating system for your instance\. This is because all RAID is accomplished at the software level\. For greater I/O performance than you can achieve with a single volume, RAID 0 can stripe multiple volumes together; for on\-instance redundancy, RAID 1 can mirror two volumes together\. Amazon EBS volume data is replicated across multiple servers in an Availability Zone to prevent the loss of data from the failure of any single component\. This replication makes Amazon EBS volumes ten times more reliable than typical commodity disk drives\. For more information, see [Amazon EBS Availability and Durability](https://aws.amazon.com/ebs/details/#Amazon_EBS_Availability_and_Durability) in the Amazon EBS product detail pages\. **Note** You should avoid booting from a RAID volume\. Grub is typically installed on only one device in a RAID array, and if one of the mirrored devices fails, you may be unable to boot the operating system\. If you need to create a RAID array on a Windows instance, see [RAID Configuration on Windows](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/raid-config.html) in the *Amazon EC2 User Guide for Windows Instances*\. **Topics** + [RAID Configuration Options](#raid-config-options) + [Creating a RAID Array on Linux](#linux-raid)
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/raid-config.md
60521712cf12-1
+ [RAID Configuration Options](#raid-config-options) + [Creating a RAID Array on Linux](#linux-raid) + [Creating Snapshots of Volumes in a RAID Array](#ebs-snapshots-raid-array)
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/raid-config.md
eb6ee58972d6-0
The following table compares the common RAID 0 and RAID 1 options\. | Configuration | Use | Advantages | Disadvantages | | --- | --- | --- | --- | | RAID 0 | When I/O performance is more important than fault tolerance; for example, as in a heavily used database \(where data replication is already set up separately\)\. | I/O is distributed across the volumes in a stripe\. If you add a volume, you get the straight addition of throughput and IOPS\. | Performance of the stripe is limited to the worst performing volume in the set\. Loss of a single volume results in a complete data loss for the array\. | | RAID 1 | When fault tolerance is more important than I/O performance; for example, as in a critical application\. | Safer from the standpoint of data durability\. | Does not provide a write performance improvement; requires more Amazon EC2 to Amazon EBS bandwidth than non\-RAID configurations because the data is written to multiple volumes simultaneously\. | **Important** RAID 5 and RAID 6 are not recommended for Amazon EBS because the parity write operations of these RAID modes consume some of the IOPS available to your volumes\. Depending on the configuration of your RAID array, these RAID modes provide 20\-30% fewer usable IOPS than a RAID 0 configuration\. Increased cost is a factor with these RAID modes as well; when using identical volume sizes and speeds, a 2\-volume RAID 0 array can outperform a 4\-volume RAID 6 array that costs twice as much\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/raid-config.md
eb6ee58972d6-1
Creating a RAID 0 array allows you to achieve a higher level of performance for a file system than you can provision on a single Amazon EBS volume\. A RAID 1 array offers a "mirror" of your data for extra redundancy\. Before you perform this procedure, you need to decide how large your RAID array should be and how many IOPS you want to provision\. The resulting size of a RAID 0 array is the sum of the sizes of the volumes within it, and the bandwidth is the sum of the available bandwidth of the volumes within it\. The resulting size and bandwidth of a RAID 1 array is equal to the size and bandwidth of the volumes in the array\. For example, two 500 GiB Amazon EBS `io1` volumes with 4,000 provisioned IOPS each will create a 1000 GiB RAID 0 array with an available bandwidth of 8,000 IOPS and 1,000 MiB/s of throughput or a 500 GiB RAID 1 array with an available bandwidth of 4,000 IOPS and 500 MiB/s of throughput\. This documentation provides basic RAID setup examples\. For more information about RAID configuration, performance, and recovery, see the Linux RAID Wiki at [https://raid\.wiki\.kernel\.org/index\.php/Linux\_Raid](https://raid.wiki.kernel.org/index.php/Linux_Raid)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/raid-config.md
0695efa1ae2b-0
Use the following procedure to create the RAID array\. Note that you can get directions for Windows instances from [Creating a RAID Array on Windows](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/raid-config.html#windows-raid) in the *Amazon EC2 User Guide for Windows Instances*\. **To create a RAID array on Linux** 1. Create the Amazon EBS volumes for your array\. For more information, see [Creating an Amazon EBS volume](ebs-creating-volume.md)\. **Important** Create volumes with identical size and IOPS performance values for your array\. Make sure you do not create an array that exceeds the available bandwidth of your EC2 instance\. For more information, see [Amazon EBS–optimized instances](ebs-optimized.md)\. 1. Attach the Amazon EBS volumes to the instance that you want to host the array\. For more information, see [Attaching an Amazon EBS volume to an instance](ebs-attaching-volume.md)\. 1. Use the mdadm command to create a logical RAID device from the newly attached Amazon EBS volumes\. Substitute the number of volumes in your array for *number\_of\_volumes* and the device names for each volume in the array \(such as `/dev/xvdf`\) for *device\_name*\. You can also substitute *MY\_RAID* with your own unique name for the array\. **Note** You can list the devices on your instance with the lsblk command to find the device names\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/raid-config.md
0695efa1ae2b-1
**Note** You can list the devices on your instance with the lsblk command to find the device names\. \(RAID 0 only\) To create a RAID 0 array, execute the following command \(note the `--level=0` option to stripe the array\): ``` [ec2-user ~]$ sudo mdadm --create --verbose /dev/md0 --level=0 --name=MY_RAID --raid-devices=number_of_volumes device_name1 device_name2 ``` \(RAID 1 only\) To create a RAID 1 array, execute the following command \(note the `--level=1` option to mirror the array\): ``` [ec2-user ~]$ sudo mdadm --create --verbose /dev/md0 --level=1 --name=MY_RAID --raid-devices=number_of_volumes device_name1 device_name2 ``` 1. Allow time for the RAID array to initialize and synchronize\. You can track the progress of these operations with the following command: ``` [ec2-user ~]$ sudo cat /proc/mdstat ``` The following is example output: ``` Personalities : [raid1] md0 : active raid1 xvdg[1] xvdf[0]
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/raid-config.md
0695efa1ae2b-2
``` Personalities : [raid1] md0 : active raid1 xvdg[1] xvdf[0] 20955008 blocks super 1.2 [2/2] [UU] [=========>...........] resync = 46.8% (9826112/20955008) finish=2.9min speed=63016K/sec ``` In general, you can display detailed information about your RAID array with the following command: ``` [ec2-user ~]$ sudo mdadm --detail /dev/md0 ``` The following is example output: ``` /dev/md0: Version : 1.2 Creation Time : Mon Jun 27 11:31:28 2016 Raid Level : raid1 Array Size : 20955008 (19.98 GiB 21.46 GB) Used Dev Size : 20955008 (19.98 GiB 21.46 GB) Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent Update Time : Mon Jun 27 11:37:02 2016 State : clean ... ... ... Number Major Minor RaidDevice State 0 202 80 0 active sync /dev/sdf
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/raid-config.md
0695efa1ae2b-3
... ... Number Major Minor RaidDevice State 0 202 80 0 active sync /dev/sdf 1 202 96 1 active sync /dev/sdg ``` 1. Create a file system on your RAID array, and give that file system a label to use when you mount it later\. For example, to create an ext4 file system with the label *MY\_RAID*, execute the following command: ``` [ec2-user ~]$ sudo mkfs.ext4 -L MY_RAID /dev/md0 ``` Depending on the requirements of your application or the limitations of your operating system, you can use a different file system type, such as ext3 or XFS \(consult your file system documentation for the corresponding file system creation command\)\. 1. To ensure that the RAID array is reassembled automatically on boot, create a configuration file to contain the RAID information: ``` [ec2-user ~]$ sudo mdadm --detail --scan | sudo tee -a /etc/mdadm.conf ``` **Note** If you are using a Linux distribution other than Amazon Linux, this file may need to be placed in different location\. For more information, consult man mdadm\.conf on your Linux system\.\. 1. Create a new ramdisk image to properly preload the block device modules for your new RAID configuration: ```
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/raid-config.md
0695efa1ae2b-4
1. Create a new ramdisk image to properly preload the block device modules for your new RAID configuration: ``` [ec2-user ~]$ sudo dracut -H -f /boot/initramfs-$(uname -r).img $(uname -r) ``` 1. Create a mount point for your RAID array\. ``` [ec2-user ~]$ sudo mkdir -p /mnt/raid ``` 1. Finally, mount the RAID device on the mount point that you created: ``` [ec2-user ~]$ sudo mount LABEL=MY_RAID /mnt/raid ``` Your RAID device is now ready for use\. 1. \(Optional\) To mount this Amazon EBS volume on every system reboot, add an entry for the device to the `/etc/fstab` file\. 1. Create a backup of your `/etc/fstab` file that you can use if you accidentally destroy or delete this file while you are editing it\. ``` [ec2-user ~]$ sudo cp /etc/fstab /etc/fstab.orig ``` 1. Open the `/etc/fstab` file using your favorite text editor, such as nano or vim\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/raid-config.md
0695efa1ae2b-5
``` 1. Open the `/etc/fstab` file using your favorite text editor, such as nano or vim\. 1. Comment out any lines starting with "`UUID=`" and, at the end of the file, add a new line for your RAID volume using the following format: ``` device_label mount_point file_system_type fs_mntops fs_freq fs_passno ``` The last three fields on this line are the file system mount options, the dump frequency of the file system, and the order of file system checks done at boot time\. If you don't know what these values should be, then use the values in the example below for them \(`defaults,nofail 0 2)`\. For more information about `/etc/fstab` entries, see the fstab manual page \(by entering man fstab on the command line\)\. For example, to mount the ext4 file system on the device with the label MY\_RAID at the mount point `/mnt/raid`, add the following entry to `/etc/fstab`\. **Note** If you ever intend to boot your instance without this volume attached \(for example, so this volume could move back and forth between different instances\), you should add the `nofail` mount option that allows the instance to boot even if there are errors in mounting the volume\. Debian derivatives, such as Ubuntu, must also add the `nobootwait` mount option\. ```
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/raid-config.md
0695efa1ae2b-6
``` LABEL=MY_RAID /mnt/raid ext4 defaults,nofail 0 2 ``` 1. After you've added the new entry to `/etc/fstab`, you need to check that your entry works\. Run the sudo mount \-a command to mount all file systems in `/etc/fstab`\. ``` [ec2-user ~]$ sudo mount -a ``` If the previous command does not produce an error, then your `/etc/fstab` file is OK and your file system will mount automatically at the next boot\. If the command does produce any errors, examine the errors and try to correct your `/etc/fstab`\. **Warning** Errors in the `/etc/fstab` file can render a system unbootable\. Do not shut down a system that has errors in the `/etc/fstab` file\. 1. \(Optional\) If you are unsure how to correct `/etc/fstab` errors, you can always restore your backup `/etc/fstab` file with the following command\. ``` [ec2-user ~]$ sudo mv /etc/fstab.orig /etc/fstab ```
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/raid-config.md
030601f24862-0
If you want to back up the data on the EBS volumes in a RAID array using snapshots, you must ensure that the snapshots are consistent\. This is because the snapshots of these volumes are created independently\. To restore EBS volumes in a RAID array from snapshots that are out of sync would degrade the integrity of the array\. To create a consistent set of snapshots for your RAID array, use [EBS multi\-volume snapshots](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSnapshots.html)\. Multi\-volume snapshots allow you to take point\-in\-time, data coordinated, and crash\-consistent snapshots across multiple EBS volumes attached to an EC2 instance\. You do not have to stop your instance to coordinate between volumes to ensure consistency because snapshots are automatically taken across multiple EBS volumes\. For more information, see the steps for creating multi\-volume snapshots under [Creating Amazon EBS Snapshots](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-creating-snapshot.html)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/raid-config.md
796f1e760c94-0
You can assign a security group to an instance when you launch the instance\. When you add or remove rules, those changes are automatically applied to all instances to which you've assigned the security group\. After you launch an instance, you can change its security groups\. For more information, see [Changing an Instance's Security Groups](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html#SG_Changing_Group_Membership) in the *Amazon VPC User Guide*\. You can create, view, update, and delete security groups and security group rules using the Amazon EC2 console and the command line tools\. **Topics** + [Creating a security group](#creating-security-group) + [Copying a security group](#copy-security-group) + [Viewing your security groups](#describing-security-group) + [Adding rules to a security group](#adding-security-group-rule) + [Updating Security Group Rules](#updating-security-group-rules) + [Deleting rules from a security group](#deleting-security-group-rule) + [Deleting a security group](#deleting-security-group)
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/working-with-security-groups.md
6a836af9c362-0
You can create a custom security group using one of the following methods\. You must specify the VPC for which you're creating the security group\. ------
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/working-with-security-groups.md
889cff7af133-0
**To create a security group** 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 **Security Groups**\. 1. Choose **Create security group**\. 1. In the **Basic details** section, do the following\. 1. Enter a descriptive name and brief description for the security group\. The name and description can be up to 255 characters long, and they can include `a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*`\. 1. For **VPC**, choose the VPC in which to create the security group\. The security group can only be used in the VPC in which it is created\. 1. You can add security group rules now, or you can add them at any time after you have created the security group\. For more information about adding security group rules, see [Adding rules to a security group](#adding-security-group-rule)\. 1. Choose **Create**\. ------
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/working-with-security-groups.md
ee90d4fd9f42-0
**To create a security group** 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 **Security Groups**\. 1. Choose **Create Security Group**\. 1. Specify a name and description for the security group\. 1. For **VPC**, choose the ID of the VPC\. 1. You can start adding rules, or you can choose **Create** to create the security group now \(you can always add rules later\)\. For more information about adding rules, see [Adding rules to a security group](#adding-security-group-rule)\. ------
https://github.com/siagholami/aws-documentation/tree/main/documents/amazon-ec2-user-guide/doc_source/working-with-security-groups.md