Back to Aws Doc Sdk Examples

Auto Scaling code examples for the SDK for .NET (v4)

dotnetv4/AutoScaling/README.md

latest5.1 KB
Original Source

Auto Scaling code examples for the SDK for .NET (v4)

Overview

Shows how to use the AWS SDK for .NET (v4) to work with Amazon EC2 Auto Scaling.

<!--custom.overview.start--> <!--custom.overview.end-->

Auto Scaling automatically scales EC2 instances, either with scaling policies or with scheduled scaling.

⚠ Important

  • Running this code might result in charges to your AWS account. For more details, see AWS Pricing and Free Tier.
  • Running the tests might result in charges to your AWS account.
  • We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see Grant least privilege.
  • This code is not tested in every AWS Region. For more information, see AWS Regional Services.
<!--custom.important.start--> <!--custom.important.end-->

Code examples

Prerequisites

For prerequisites, see the README in the dotnetv4 folder.

<!--custom.prerequisites.start--> <!--custom.prerequisites.end-->

Get started

Basics

Code examples that show you how to perform the essential operations within a service.

Single actions

Code excerpts that show you how to call individual service functions.

<!--custom.examples.start--> <!--custom.examples.end-->

Run the examples

Instructions

<!--custom.instructions.start--> <!--custom.instructions.end-->

Hello Auto Scaling

This example shows you how to get started using Auto Scaling.

Learn the basics

This example shows you how to do the following:

  • Create an Amazon EC2 Auto Scaling group with a launch template and Availability Zones, and get information about running instances.
  • Enable Amazon CloudWatch metrics collection.
  • Update the group's desired capacity and wait for an instance to start.
  • Terminate an instance in the group.
  • List scaling activities that occur in response to user requests and capacity changes.
  • Get statistics for CloudWatch metrics, then clean up resources.
<!--custom.basic_prereqs.auto-scaling_Scenario_GroupsAndInstances.start--> <!--custom.basic_prereqs.auto-scaling_Scenario_GroupsAndInstances.end--> <!--custom.basics.auto-scaling_Scenario_GroupsAndInstances.start-->
Configuration settings

This example uses several configuration settings that are stored in settings.json to change the existing values.

Note: The image ID, instance type, and Availability Zone must be available in the same AWS Region as the account that's used to run the scenario. For information about how to get valid settings, see Find a Linux AMI.

  • GroupName - The name to use for the Auto Scaling group.
  • ImageId - The image ID to use with the Amazon EC2 Auto Scaling template. The AMI-ID column of the Amazon EC2 image locator table.
  • InstanceType - The instance type to use with the template. The Instance Type column of the Amazon EC2 image locator table.
  • LaunchTemplateName - The name of the launch template.
  • AvailabilityZone - The Availability Zone for the launch template. The Zone column of the Amazon EC2 image locator table.
  • ServiceLinkedRoleArn - The Amazon Resource Name (ARN) of a serivce-linked role that will be used to create the Auto Scaling group.
<!--custom.basics.auto-scaling_Scenario_GroupsAndInstances.end-->

Tests

⚠ Running tests might result in charges to your AWS account.

To find instructions for running these tests, see the README in the dotnetv4 folder.

<!--custom.tests.start--> <!--custom.tests.end-->

Additional resources

<!--custom.resources.start--> <!--custom.resources.end-->

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0