Skip to content

Commit 7350137

Browse files
committed
Anthropic aligned docs from JSON definitions
1 parent 49572b7 commit 7350137

10 files changed

Lines changed: 241 additions & 82 deletions

File tree

docs/modules_syntax.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
:titlesonly:
88

99
syntax/compose_x/ecs.details/*
10+
syntax/compose_x/ecs.details/environment
1011

1112

1213
.. toctree::

docs/syntax/compose_x/alarms.rst

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,18 @@ x-alarms
1717
Properties: {}
1818
MacroParameters: {}
1919
Settings: {}
20-
Services: {}
21-
Topics: []
20+
Services:
21+
service-name:
22+
Scaling:
23+
Steps:
24+
- LowerBound: 0
25+
UpperBound: 100
26+
Count: 2
27+
Topics:
28+
- TopicArn: "arn:aws:sns:us-east-1:123456789012:my-topic"
29+
NotifyOn: alarm
30+
- x-sns: topic-name
31+
NotifyOn: all
2232
2333
Define AWS CloudWatch alarms on the different resources, services, and define actions.
2434

@@ -50,10 +60,24 @@ Services
5060
5161
x-alarms:
5262
kafka-scaling-01:
53-
Properties: {}
63+
Properties:
64+
AlarmName: "high-cpu-usage"
65+
MetricName: "CPUUtilization"
66+
Namespace: "AWS/ECS"
67+
Statistic: "Average"
68+
Period: 300
69+
EvaluationPeriods: 2
70+
Threshold: 80.0
71+
ComparisonOperator: "GreaterThanThreshold"
5472
Services:
55-
<service_name>:
56-
Scaling: {} # Service scaling definition
73+
my-service:
74+
Scaling:
75+
Steps:
76+
- LowerBound: 0
77+
UpperBound: 100
78+
Count: 2
79+
- LowerBound: 100
80+
Count: 4
5781
5882
5983
Scaling
@@ -72,11 +96,19 @@ Topics
7296
7397
x-alarms:
7498
alarms-01:
75-
Properties: {}
99+
Properties:
100+
AlarmName: "service-health-check"
101+
MetricName: "HealthyHostCount"
102+
Namespace: "AWS/ApplicationELB"
103+
Statistic: "Average"
104+
Period: 60
105+
EvaluationPeriods: 2
106+
Threshold: 1.0
107+
ComparisonOperator: "LessThanThreshold"
76108
Topics:
77-
- TopicArn: <str>
109+
- TopicArn: "arn:aws:sns:us-east-1:123456789012:alerts-topic"
78110
NotifyOn: okay
79-
- x-sns: <str>
111+
- x-sns: notification-topic
80112
NotifyOn: all
81113
82114
TopicArn
@@ -153,17 +185,32 @@ to define is the Alarm expression
153185
.. code-block:: yaml
154186
155187
MacroParameters:
156-
CompositeExpression: <str>
188+
CompositeExpression: "ALARM(alarm-01) and ALARM(alarm-02)"
157189
158190
ServiceName
159191
--------------
160192

161193
Allows to set the service name or family defined in the compose file, and automatically fills in the ``Cluster``
162194
and ``ServiceName`` Dimensions.
163195

196+
.. code-block:: yaml
197+
198+
x-alarms:
199+
service-cpu-alarm:
200+
MacroParameters:
201+
ServiceName: my-web-service
202+
Properties:
203+
MetricName: "CPUUtilization"
204+
Namespace: "AWS/ECS"
205+
Statistic: "Average"
206+
Period: 300
207+
EvaluationPeriods: 2
208+
Threshold: 75.0
209+
ComparisonOperator: "GreaterThanThreshold"
210+
164211
.. note::
165212

166-
If you did set ``Dimensions`` in the Properties, these will be overriden.
213+
If you did set ``Dimensions`` in the Properties, these will be overridden.
167214

168215
CompositeExpression
169216
--------------------

docs/syntax/compose_x/common.rst

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ This is accomplished by using **AWS Resources Group Tags API** which means, you
222222
223223
Lookup:
224224
Tags:
225-
- Key: Value
226-
- Key: Value
227-
RoleArn: <str|optional>
225+
- Environment: production
226+
- Application: web-service
227+
RoleArn: "arn:aws:iam::123456789012:role/cross-account-lookup"
228228
229229
.. hint::
230230

@@ -233,9 +233,30 @@ This is accomplished by using **AWS Resources Group Tags API** which means, you
233233
Tags
234234
------
235235

236-
The tags are a list of Tags that have been assigned to the resource. Based on the type of resource, this might
236+
The tags are a list of key-value pairs that have been assigned to the resource. Based on the type of resource, this might
237237
need to resolve to a single specific resource in your AWS account / region.
238238

239+
Tags can be specified in two formats:
240+
241+
.. code-block:: yaml
242+
:caption: Object format (key-value pairs)
243+
244+
Tags:
245+
Environment: production
246+
Application: web-service
247+
Owner: devops-team
248+
249+
.. code-block:: yaml
250+
:caption: Array format (list of objects)
251+
252+
Tags:
253+
- Key: Environment
254+
Value: production
255+
- Key: Application
256+
Value: web-service
257+
- Key: Owner
258+
Value: devops-team
259+
239260
RoleArn
240261
--------
241262

@@ -247,6 +268,25 @@ your templates in a central CICD account.
247268

248269
Compose-X will never modify the looked up object!
249270

271+
Example Lookup Configuration
272+
-----------------------------
273+
274+
.. code-block:: yaml
275+
:caption: Complete lookup example
276+
277+
x-s3:
278+
existing-bucket:
279+
Lookup:
280+
Tags:
281+
Environment: production
282+
Project: myapp
283+
RoleArn: "arn:aws:iam::123456789012:role/cross-account-lookup"
284+
Services:
285+
web-service:
286+
Access:
287+
bucket: ListOnly
288+
objects: RW
289+
250290
251291
.. warning::
252292

@@ -257,6 +297,10 @@ your templates in a central CICD account.
257297

258298
Tags keys and values are case sensitive.
259299

300+
.. note::
301+
302+
When using the object format for tags, ECS Compose-X will automatically convert them to the array format internally for AWS API compatibility.
303+
260304
.. _settings_syntax_reference:
261305

262306
Settings

docs/syntax/compose_x/ecs.details/alarms.rst

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services.x-alarms
1515
app01:
1616
x-alarms:
1717
Predefined:
18-
RuleName:
18+
HighCpuUsageAndMaxScaledOut:
1919
Topics: [] # Similar to other x-alarms settings
2020
Settings: {} # Input values override.
2121
@@ -65,10 +65,14 @@ count is equal to the max scaling capacity (or otherwise overriden value).
6565
.. code-block:: yaml
6666
:caption: Example at 50% CPU usage and override to 4 tasks.
6767
68-
- Name: HighCpuUsageAndMaxScaledOut
69-
Settings:
70-
CPUUtilization: 50 # In percent
71-
RunningTaskCount: 4 # Number of tasks to evaluate against.
68+
services:
69+
app01:
70+
x-alarms:
71+
Predefined:
72+
HighCpuUsageAndMaxScaledOut:
73+
Settings:
74+
CPUUtilization: 50 # In percent
75+
RunningTaskCount: 4 # Number of tasks to evaluate against.
7276
7377
7478
HighRamUsageAndMaxScaledOut
@@ -89,12 +93,16 @@ This rule will trigger an alert when the CPUUtilization of a given service will
8993
count is equal to the max scaling capacity (or otherwise overriden value).
9094

9195
.. code-block:: yaml
92-
:caption: Example at 50% CPU usage and override to 4 tasks.
96+
:caption: Example at 50% RAM usage and override to 4 tasks.
9397
94-
- Name: HighRamUsageAndMaxScaledOut
95-
Settings:
96-
MemoryUtilization: 50 # In percent
97-
RunningTaskCount: 4 # Number of tasks to evaluate against.
98+
services:
99+
app01:
100+
x-alarms:
101+
Predefined:
102+
HighRamUsageAndMaxScaledOut:
103+
Settings:
104+
MemoryUtilization: 50 # In percent
105+
RunningTaskCount: 4 # Number of tasks to evaluate against.
98106
99107
100108

docs/syntax/compose_x/ecs.details/ecs.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ services.x-ecs
1414
serviceA:
1515
image: nginx/nginx
1616
x-ecs:
17-
CapacityProviderStrategy: [CapacityProviderStrategyItem]
18-
EnableExecuteCommand: bool
19-
CpuArchitecture: str
20-
OperatingSystemFamily: str
17+
CapacityProviderStrategy:
18+
- CapacityProvider: FARGATE
19+
Base: 1
20+
Weight: 2
21+
EnableExecuteCommand: true
22+
CpuArchitecture: ARM64
23+
OperatingSystemFamily: LINUX
2124
2225
CapacityProviderStrategy
2326
============================
@@ -76,6 +79,7 @@ Examples
7679
- CapacityProvider: FARGATE_SPOT
7780
Base: 4
7881
Weight: 8
82+
EnableExecuteCommand: true
7983
8084
8185
.. code-block:: yaml
@@ -91,6 +95,7 @@ Examples
9195
- CapacityProvider: FARGATE
9296
Base: 1
9397
Weight: 2
98+
CpuArchitecture: X86_64
9499
nginx:
95100
deploy:
96101
labels:
@@ -103,6 +108,7 @@ Examples
103108
- CapacityProvider: FARGATE_SPOT
104109
Base: 4
105110
Weight: 8
111+
CpuArchitecture: X86_64
106112
107113
In the above example, where grafana and nginx are part of the same task definition and therefore same ECS Service,
108114
we do the following:

docs/syntax/compose_x/ecs.details/monitoring.rst

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ services.x-monitoring
1414
services:
1515
serviceA:
1616
x-monitoring:
17-
CWAgentCollectEmf: bool|SidecarConfig
17+
CWAgentCollectEmf: true
18+
CollectEmf:
19+
CloudwatchAgent:
20+
UseLatest: true
21+
InterpolateWithDigest: false
1822
1923
Shorthands for monitoring features.
2024

@@ -35,21 +39,24 @@ See the `AWS CloudWatch agent & EMF Configuration for details`_ of what's config
3539
boolean value
3640
-------------
3741

38-
When set to true|false, enables the sidecar using the `latest CloudWatch agent image from AWS ECR Public`_.
42+
When set to true, enables the sidecar using the `latest CloudWatch agent image from AWS ECR Public`_.
43+
When set to false, disables EMF collection entirely.
3944

4045
SidecarConfig
4146
--------------
4247

4348
This configuration allows you to define more options to control the behaviour of the used sidecar image.
4449
You must explicitly set either ``UseLatest`` or `OverrideImage`_
4550

46-
.. code-block::
51+
.. code-block:: yaml
4752
48-
x-monitoring:
49-
CWAgentCollectEmf:
50-
InterpolateWithDigest: bool
51-
OverrideImage: str
52-
UseLatest: bool
53+
services:
54+
serviceA:
55+
x-monitoring:
56+
CWAgentCollectEmf:
57+
InterpolateWithDigest: true
58+
OverrideImage: "public.ecr.aws/cloudwatch-agent/cloudwatch-agent:1.247357.0b252275"
59+
UseLatest: false
5360
5461
.. hint::
5562

@@ -58,12 +65,14 @@ You must explicitly set either ``UseLatest`` or `OverrideImage`_
5865
OverrideImage
5966
^^^^^^^^^^^^^^
6067

61-
.. code-block::
68+
.. code-block:: yaml
6269
63-
x-monitoring:
64-
CWAgentCollectEmf:
65-
InterpolateWithDigest: false
66-
OverrideImage: public.ecr.aws/cloudwatch-agent/cloudwatch-agent:1.247357.0b252275
70+
services:
71+
serviceA:
72+
x-monitoring:
73+
CWAgentCollectEmf:
74+
InterpolateWithDigest: false
75+
OverrideImage: "public.ecr.aws/cloudwatch-agent/cloudwatch-agent:1.247357.0b252275"
6776
6877
.. note::
6978

@@ -80,12 +89,14 @@ the digest.
8089
This setting is recommended if you want to ensure that the image used is going to be consistently the same throughout
8190
the lifecycle of your Task Definition revision.
8291

83-
.. code-block::
92+
.. code-block:: yaml
8493
85-
x-monitoring:
86-
CWAgentCollectEmf:
87-
InterpolateWithDigest: true
88-
UseLatest: true
94+
services:
95+
serviceA:
96+
x-monitoring:
97+
CWAgentCollectEmf:
98+
InterpolateWithDigest: true
99+
UseLatest: true
89100
90101
.. _AWS CloudWatch agent & EMF Configuration for details: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Embedded_Metric_Format_Generation_CloudWatch_Agent.html
91102
.. _latest CloudWatch agent image from AWS ECR Public: https://gallery.ecr.aws/cloudwatch-agent/cloudwatch-agent

0 commit comments

Comments
 (0)