Skip to content

Commit c3344ef

Browse files
author
andrew
committed
merge
1 parent acca9c6 commit c3344ef

File tree

2 files changed

+19
-179
lines changed

2 files changed

+19
-179
lines changed

docs/command-reference.md

Lines changed: 1 addition & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ Create a CloudFormation Stack
204204
to take advantage of shorter commands*
205205

206206
USAGE: stack-create stack [template-file] [parameters-file] \
207-
[--capabilities=OPTIONAL_VALUE] [--role-arn=OPTIONAL_VALUE]
207+
[CAPABILITY_1 CAPABILITY_2] [--role-arn=OPTIONAL_VALUE]
208208

209209
$ stack-create params/asg-params-prod.json
210210
Resolved arguments: asg-prod ./asg.yml params/asg-params-prod.json
@@ -1372,24 +1372,6 @@ List all deployment IDs for a deployment group (not useful for the user, only in
13721372
List all deployment groups for an application
13731373

13741374

1375-
## codedeploy-commands~
1376-
1377-
1378-
### deployment
1379-
1380-
List deployments
1381-
1382-
1383-
### deployments
1384-
1385-
List all deployment IDs for a deployment group (not useful for the user, only internal)
1386-
1387-
1388-
### deployment-groups
1389-
1390-
List all deployment groups for an application
1391-
1392-
13931375
## ecr-commands
13941376

13951377

@@ -1406,136 +1388,6 @@ List images for ECR Repositories
14061388
## ecs-commands
14071389

14081390

1409-
### ecs-clusters2
1410-
1411-
List ECS clusters
1412-
output includes clusterName,status,activeServicesCount,runningTasksCount,pendingTasksCount
1413-
if you pass an argument, it'll filter for clusters whose ARN contains your text
1414-
1415-
$ ecs-clusters test
1416-
test-octopus-ecs-cluster ACTIVE 1 1 0
1417-
test1-ecs-cluster ACTIVE 3 1 0
1418-
test3-ecs-cluster ACTIVE 3 1 0
1419-
test2-ecs-cluster ACTIVE 3 3 0
1420-
1421-
1422-
### ecs-services2
1423-
1424-
List ECS services
1425-
output includes serviceName,status,desiredCount,runningCount,pendingCount,createdAt
1426-
1427-
gets all clusters if no filter passed in
1428-
if you do pass a filter:
1429-
1. if your filter is the name of one of your clusters, it will list the services in that cluster (eg ecs-clusters test1 | ecs-services)
1430-
2. if your filter is not a cluster name, it will list the services in all clusters whose names match your filter (ie it filters on cluster name not service name)
1431-
3. if you do not pass a filter, it will list all services in all clusters
1432-
1433-
$ ecs-clusters test1|ecs-services
1434-
test1-ecs-admin-7URaUr0YGJHi ACTIVE 0 0 0 2023-09-13T17:16:48.198000+10:00
1435-
test1-ecs-public-wEaTAqGXqbpq ACTIVE 0 0 0 2023-09-13T16:54:54.162000+10:00
1436-
test1-ecs-hangfire-YNIo1hlx8rjn ACTIVE 1 1 0 2023-09-13T16:39:06.218000+10:00
1437-
1438-
1439-
### ecs-tasks
1440-
1441-
List ECS tasks
1442-
output includes taskDefinitionArn, createdAt, cpu, memory
1443-
1444-
gets all tasks if no filter passed in
1445-
if you do pass a filter, it filters on the task name. All clusters are included (I haven't worked out a way of passing a cluster name AND a filter)
1446-
1447-
$ ecs-tasks test2
1448-
arn:aws:ecs:ap-southeast-2:xxxxxxxxxxxx:task-definition/test2-public:18 2023-09-19T17:51:56.418000+10:00 2048 4096
1449-
arn:aws:ecs:ap-southeast-2:xxxxxxxxxxxx:task-definition/test2-admin:20 2023-08-29T10:03:36.956000+10:00 2048 4096
1450-
arn:aws:ecs:ap-southeast-2:xxxxxxxxxxxx:task-definition/test2-hangfire:22 2023-09-19T17:11:06.622000+10:00 1024 2048
1451-
1452-
1453-
### ecs-scaling-activities
1454-
1455-
LIst autoscaling activities - the actual scaling events that have happened
1456-
eg
1457-
ecs-scaling www
1458-
2023-11-22T06:24:50.937000+11:00 www-ecs-public-ServicePublic-OuN3rXBLvmx3-AlarmLow-64de4512-d901-4b26-a6a2-184bb1e90bc6 in state ALARM triggered policy www-ecs-public-target-tracking-mem70 Successfully set desired count to 2. Change successfully fulfilled by ecs.
1459-
2023-11-22T05:25:48.611000+11:00 www-ecs-public-ServicePublic-OuN3rXBLvmx3-AlarmHigh-6408c172-647e-4c0e-aac9-a800cd83317d in state ALARM triggered policy www-ecs-public-target-tracking-mem70 Successfully set desired count to 3. Change successfully fulfilled by ecs.
1460-
1461-
1462-
### ecs-scaling-actions
1463-
1464-
List autoscaling actions - cron-based scheduled scaling
1465-
filter by environment (eg test1) or namespace (eg ecs)
1466-
if you pass an argument, it'll filter for clusters whose ARN contains your text
1467-
1468-
$ scaling-ecs 'test.*down' # list the scale-down times of all our test environments
1469-
1470-
1471-
## ecs-commands2
1472-
1473-
1474-
### ecs-clusters2
1475-
1476-
List ECS clusters
1477-
output includes clusterName,status,activeServicesCount,runningTasksCount,pendingTasksCount
1478-
if you pass an argument, it'll filter for clusters whose ARN contains your text
1479-
1480-
$ ecs-clusters test
1481-
test-octopus-ecs-cluster ACTIVE 1 1 0
1482-
test1-ecs-cluster ACTIVE 3 1 0
1483-
test3-ecs-cluster ACTIVE 3 1 0
1484-
test2-ecs-cluster ACTIVE 3 3 0
1485-
1486-
1487-
### ecs-services2
1488-
1489-
List ECS services
1490-
output includes serviceName,status,desiredCount,runningCount,pendingCount,createdAt
1491-
1492-
gets all clusters if no filter passed in
1493-
if you do pass a filter:
1494-
1. if your filter is the name of one of your clusters, it will list the services in that cluster (eg ecs-clusters test1 | ecs-services)
1495-
2. if your filter is not a cluster name, it will list the services in all clusters whose names match your filter (ie it filters on cluster name not service name)
1496-
3. if you do not pass a filter, it will list all services in all clusters
1497-
1498-
$ ecs-clusters test1|ecs-services
1499-
test1-ecs-admin-7URaUr0YGJHi ACTIVE 0 0 0 2023-09-13T17:16:48.198000+10:00
1500-
test1-ecs-public-wEaTAqGXqbpq ACTIVE 0 0 0 2023-09-13T16:54:54.162000+10:00
1501-
test1-ecs-hangfire-YNIo1hlx8rjn ACTIVE 1 1 0 2023-09-13T16:39:06.218000+10:00
1502-
1503-
1504-
### ecs-tasks
1505-
1506-
List ECS tasks
1507-
output includes taskDefinitionArn, createdAt, cpu, memory
1508-
1509-
gets all tasks if no filter passed in
1510-
if you do pass a filter, it filters on the task name. All clusters are included (I haven't worked out a way of passing a cluster name AND a filter)
1511-
1512-
$ ecs-tasks test2
1513-
arn:aws:ecs:ap-southeast-2:xxxxxxxxxxxx:task-definition/test2-public:18 2023-09-19T17:51:56.418000+10:00 2048 4096
1514-
arn:aws:ecs:ap-southeast-2:xxxxxxxxxxxx:task-definition/test2-admin:20 2023-08-29T10:03:36.956000+10:00 2048 4096
1515-
arn:aws:ecs:ap-southeast-2:xxxxxxxxxxxx:task-definition/test2-hangfire:22 2023-09-19T17:11:06.622000+10:00 1024 2048
1516-
1517-
1518-
### ecs-scaling-activities
1519-
1520-
LIst autoscaling activities - the actual scaling events that have happened
1521-
eg
1522-
ecs-scaling www
1523-
2023-11-22T06:24:50.937000+11:00 www-ecs-public-ServicePublic-OuN3rXBLvmx3-AlarmLow-64de4512-d901-4b26-a6a2-184bb1e90bc6 in state ALARM triggered policy www-ecs-public-target-tracking-mem70 Successfully set desired count to 2. Change successfully fulfilled by ecs.
1524-
2023-11-22T05:25:48.611000+11:00 www-ecs-public-ServicePublic-OuN3rXBLvmx3-AlarmHigh-6408c172-647e-4c0e-aac9-a800cd83317d in state ALARM triggered policy www-ecs-public-target-tracking-mem70 Successfully set desired count to 3. Change successfully fulfilled by ecs.
1525-
1526-
1527-
### ecs-scaling-actions
1528-
1529-
List autoscaling actions - cron-based scheduled scaling
1530-
filter by environment (eg test1) or namespace (eg ecs)
1531-
if you pass an argument, it'll filter for clusters whose ARN contains your text
1532-
1533-
$ scaling-ecs 'test.*down' # list the scale-down times of all our test environments
1534-
1535-
1536-
## ecs-commands~
1537-
1538-
15391391
### ecs-clusters
15401392

15411393
List ECS clusters
@@ -2126,35 +1978,6 @@ Generate NS records for delegating domain to AWS
21261978
$ hosted-zones | hosted-zone-a-records
21271979

21281980

2129-
## route53-commandsTEMP
2130-
2131-
2132-
### hosted-zones
2133-
2134-
List Route53 Hosted Zones
2135-
2136-
$ hosted-zones
2137-
/hostedzone/Z3333333333333 5 NotPrivateZone bash-my-aws.org.
2138-
/hostedzone/Z5555555555555 2 NotPrivateZone bash-my-universe.com.
2139-
/hostedzone/Z4444444444444 3 NotPrivateZone bashmyaws.org.
2140-
/hostedzone/Z1111111111111 3 NotPrivateZone bash-my-aws.com.
2141-
/hostedzone/Z2222222222222 3 NotPrivateZone bashmyaws.com.
2142-
2143-
2144-
### hosted-zone-ns-records
2145-
2146-
Generate NS records for delegating domain to AWS
2147-
2148-
$ hosted-zones bash-my-aws.org
2149-
/hostedzone/ZJ6ZCG2UD6OKX 5 NotPrivateZone bash-my-aws.org.
2150-
2151-
$ hosted-zones bash-my-aws.org | hosted-zone-ns-records
2152-
bash-my-aws.org. 300 IN NS ns-786.awsdns-34.net.
2153-
bash-my-aws.org. 300 IN NS ns-1549.awsdns-01.co.uk.
2154-
bash-my-aws.org. 300 IN NS ns-362.awsdns-45.com.
2155-
bash-my-aws.org. 300 IN NS ns-1464.awsdns-55.org.
2156-
2157-
21581981
## s3-commands
21591982

21601983

lib/stack-functions

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,22 @@ stack-create() {
198198
--disable-rollback \
199199
--output text; then
200200
stack-tail $stack
201+
else
202+
echo "$output"
203+
if [[ $output == *"InsufficientCapabilitiesException"* ]] ; then
204+
for capability in ${list_capabilities} ; do
205+
if [[ $output == *"$capability"* ]] ; then
206+
capabilities="${capabilities} ${capability}"
207+
fi
208+
done
209+
if [[ $capabilities ]] ; then
210+
local regex_yes="^[Yy]$"
211+
read -p "Do you want to try again with these capabilities? " -n 1 -r
212+
echo
213+
[[ $REPLY =~ $regex_yes ]] || return 0
214+
stack-create $@ ${capabilities}
215+
fi
216+
fi
201217
fi
202218
}
203219

@@ -1055,7 +1071,8 @@ _bma_stack_args(){
10551071
__bma_error "Could not find params file (${params})."
10561072
else
10571073
# Display calling (or current if none) with expanded arguments
1058-
echo "Resolved arguments: $stack $template $params"
1074+
# echo "Resolved arguments: $stack $template $params"
1075+
true
10591076
fi
10601077
}
10611078

0 commit comments

Comments
 (0)