Skip to content

Commit 6792fa0

Browse files
committed
Added timeout seconds for ssm command
If ECS execution role is deleted SSM command will not be delivered and by default the delivery timeout time is 3600 seconds or 1hour. This change adds a delivery timeout of 600 seconds or 10 min so that waiters does not have to wait so long for ssm command to complete. After this change ssm command timeouts after 10 min (timeout) + 30 min (execution timeout) = 40min.
1 parent a05f602 commit 6792fa0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

updater/aws.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ const (
2222
updateStateReady = "Ready"
2323
waiterDelay = time.Duration(15) * time.Second
2424
waiterMaxAttempts = 100
25+
// If this time is reached and the ssm command has not already started running, it will not run.
26+
deliveryTimeoutSeconds = 600
2527
)
2628

2729
type instance struct {
@@ -296,6 +298,7 @@ func (u *updater) updateInstance(inst instance) error {
296298
DocumentName: aws.String(u.rebootDocument),
297299
DocumentVersion: aws.String("$DEFAULT"),
298300
InstanceIds: aws.StringSlice(ec2IDs),
301+
TimeoutSeconds: aws.Int64(deliveryTimeoutSeconds),
299302
})
300303
if err != nil {
301304
return fmt.Errorf("failed to send reboot command: %w", err)
@@ -351,6 +354,7 @@ func (u *updater) sendCommand(instanceIDs []string, ssmDocument string) (string,
351354
DocumentName: aws.String(ssmDocument),
352355
DocumentVersion: aws.String("$DEFAULT"),
353356
InstanceIds: aws.StringSlice(instanceIDs),
357+
TimeoutSeconds: aws.Int64(deliveryTimeoutSeconds),
354358
})
355359
if err != nil {
356360
return "", fmt.Errorf("send command failed: %w", err)

0 commit comments

Comments
 (0)