Skip to content

Commit 0f2fed1

Browse files
Add ec2 docs
1 parent d5850f5 commit 0f2fed1

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ Once a budget is hit, all resources within the construct on which this budget ha
102102

103103
While `CostLimit` aspect can be applied on any node type, budget capabilities are only enabled on a subset of resources listed below. Cost generated by resources other than the one specified are not taken into account with regards to the budget limit. Only resources listed below are disabled once budget is reached.
104104

105-
-`AWS::Lambda::Function`
106-
- `AWS::EC2::Instance`
105+
- [`AWS::Lambda::Function`](./docs/lambda.md)
106+
- [🚧 `AWS::EC2::Instance`](./docs/ec2.md)
107107

108108
### Lifecycle
109109

docs/ec2.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# AWS Lambda
2+
3+
> [!NOTE]
4+
> Max AWS EC2 instances spending rate with default AWS Quotas: $63 / hour / region
5+
6+
## Usage
7+
8+
You can simply replace your `Instance` native CDK import statement by this package exported `Instance` construct.
9+
10+
```diff
11+
- import { Instance } from "@aws-cdk-lib/aws-ec2";
12+
+ import { Instance } from "@revant-io/cdk-cost-limit";
13+
```
14+
15+
The `Instance` construct accepts the exact same props at the AWS CDK Instance construct (refer to the [AWS CDK dedicated documentation](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Instance.html) for a list of all supported props). In addition to those native props, it accepts the following:
16+
17+
| Name | Type | Description |
18+
| ------- | ------ | --------------------------------------------------------------------------- |
19+
| budget? | number | The monthly budget limit for this specific resource, specified in $US cents |
20+
21+
_Example_
22+
23+
```typescript
24+
import { Instance } from "@revant-io/cdk-cost-limit";
25+
26+
const fn = new Instance(this, "MyInstance", {
27+
/* The budget allocated to this resource in $US cents.
28+
* For exemple, if you want to set a budget of $1,00
29+
* for a specific Lambda function, you should used
30+
* a value of 100 for this prop.
31+
*/
32+
budget: 100,
33+
});
34+
```
35+
36+
By default, if budget is not specified, an unlimited budget (Instance normal behavior) is used.
37+
38+
## How it works
39+
40+
Todo
41+
42+
## Manually restore
43+
44+
In order to reset `Instance` that have been disabled by a budget, you need to start the instance.
45+
46+
```sh
47+
aws ec2 start-instances --instance-ids <instanceId>
48+
```

0 commit comments

Comments
 (0)