Skip to content

Commit aa9b48b

Browse files
committed
get auto scaling done
1 parent f5c9602 commit aa9b48b

File tree

1 file changed

+21
-24
lines changed

1 file changed

+21
-24
lines changed

src/content/docs/aws/services/app-auto-scaling.md

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
title: "Application Auto Scaling"
3-
linkTitle: "Application Auto Scaling"
43
description: Get started with Application Auto Scaling on LocalStack
54
tags: ["Base"]
65
persistence: supported
@@ -14,7 +13,7 @@ With Application Auto Scaling, you can configure automatic scaling for services
1413
Auto scaling uses CloudWatch under the hood to configure scalable targets which a service namespace, resource ID, and scalable dimension can uniquely identify.
1514

1615
LocalStack allows you to use the Application Auto Scaling APIs in your local environment to scale different resources based on scaling policies and scheduled scaling.
17-
The supported APIs are available on our [API coverage page]({{< ref "coverage_application-autoscaling" >}}), which provides information on the extent of Application Auto Scaling's integration with LocalStack.
16+
The supported APIs are available on our [API coverage page](), which provides information on the extent of Application Auto Scaling's integration with LocalStack.
1817

1918
## Getting Started
2019

@@ -39,31 +38,30 @@ exports.handler = async (event, context) => {
3938

4039
Run the following command to create a new Lambda function using the [`CreateFunction`](https://docs.aws.amazon.com/cli/latest/reference/lambda/create-function.html) API:
4140

42-
{{< command >}}
43-
$ zip function.zip index.js
44-
45-
$ awslocal lambda create-function \
41+
```bash
42+
zip function.zip index.js
43+
awslocal lambda create-function \
4644
--function-name autoscaling-example \
4745
--runtime nodejs18.x \
4846
--zip-file fileb://function.zip \
4947
--handler index.handler \
5048
--role arn:aws:iam::000000000000:role/cool-stacklifter
51-
{{< /command >}}
49+
```
5250

5351
### Create a version and alias for your Lambda function
5452

5553
Next, you can create a version for your Lambda function and publish an alias.
5654
We will use the [`PublishVersion`](https://docs.aws.amazon.com/cli/latest/reference/lambda/publish-version.html) and [`CreateAlias`](https://docs.aws.amazon.com/cli/latest/reference/lambda/create-alias.html) APIs for this.
5755
Run the following commands:
5856

59-
{{< command >}}
60-
$ awslocal lambda publish-version --function-name autoscaling-example
61-
$ awslocal lambda create-alias \
57+
```bash
58+
awslocal lambda publish-version --function-name autoscaling-example
59+
awslocal lambda create-alias \
6260
--function-name autoscaling-example \
6361
--description "alias for blue version of function" \
6462
--function-version 1 \
6563
--name BLUE
66-
{{< /command >}}
64+
```
6765

6866
### Register the Lambda function as a scalable target
6967

@@ -72,35 +70,35 @@ We will specify the `--service-namespace` as `lambda`, `--scalable-dimension` as
7270

7371
Run the following command to register the scalable target:
7472

75-
{{< command >}}
76-
$ awslocal application-autoscaling register-scalable-target \
73+
```bash
74+
awslocal application-autoscaling register-scalable-target \
7775
--service-namespace lambda \
7876
--scalable-dimension lambda:function:ProvisionedConcurrency \
7977
--resource-id function:autoscaling-example:BLUE \
8078
--min-capacity 0 --max-capacity 0
81-
{{< /command >}}
79+
```
8280

8381
### Setting up a scheduled action
8482

8583
You can create a scheduled action that scales out by specifying the `--schedule` parameter with a recurring schedule specified as a cron job.
8684
Run the following command to create a scheduled action using the [`PutScheduledAction`](https://docs.aws.amazon.com/cli/latest/reference/application-autoscaling/put-scheduled-action.html) API:
8785

88-
{{< command >}}
86+
```bash
8987
awslocal application-autoscaling put-scheduled-action \
9088
--service-namespace lambda \
9189
--scalable-dimension lambda:function:ProvisionedConcurrency \
9290
--resource-id function:autoscaling-example:BLUE \
9391
--scheduled-action-name lambda-action \
9492
--schedule "cron(*/2* ** *)" \
9593
--scalable-target-action MinCapacity=1,MaxCapacity=5
96-
{{< /command >}}
94+
```
9795

9896
You can confirm if the scheduled action exists using [`DescribeScheduledActions`](https://docs.aws.amazon.com/cli/latest/reference/application-autoscaling/describe-scheduled-actions.html) API:
9997

100-
{{< command >}}
101-
$ awslocal application-autoscaling describe-scheduled-actions \
98+
```bash
99+
awslocal application-autoscaling describe-scheduled-actions \
102100
--service-namespace lambda
103-
{{< /command >}}
101+
```
104102

105103
### Setting up a target tracking scaling policy
106104

@@ -110,22 +108,21 @@ When metrics lack data due to minimal application load, Application Auto Scaling
110108

111109
Run the following command to create a target-tracking scaling policy:
112110

113-
{{< command >}}
114-
$ awslocal application-autoscaling put-scaling-policy \
111+
```bash
112+
awslocal application-autoscaling put-scaling-policy \
115113
--service-namespace lambda \
116114
--scalable-dimension lambda:function:ProvisionedConcurrency \
117115
--resource-id function:events-example:BLUE \
118116
--policy-name scaling-policy --policy-type TargetTrackingScaling \
119117
--target-tracking-scaling-policy-configuration '{ "TargetValue": 50.0, "PredefinedMetricSpecification": { "PredefinedMetricType": "predefinedmetric" }}'
120-
{{< /command >}}
118+
```
121119

122120
## Resource Browser
123121

124122
The LocalStack Web Application provides a Resource Browser for managing AppConfig applications.
125123
You can access the Resource Browser by opening the LocalStack Web Application in your browser, navigating to the **Resource Browser** section, and then clicking on **Application Auto Scaling** under the **App Integration** section.
126124

127-
<img src="application-auto-scaling-resource-browser.png" alt="Application Auto Scaling Resource Browser" title="Application Auto Scaling Resource Browser" width="900" />
128-
<br><br>
125+
![Application Auto Scaling Resource Browser](/images/aws/application-auto-scaling-resource-browser.png)
129126

130127
The Resource Browser allows you to perform the following actions:
131128

0 commit comments

Comments
 (0)