diff --git a/plugins/modules/ec2_snapshot.py b/plugins/modules/ec2_snapshot.py index a352eefffb9..ab251f0f272 100644 --- a/plugins/modules/ec2_snapshot.py +++ b/plugins/modules/ec2_snapshot.py @@ -228,6 +228,9 @@ def _describe_snapshots(ec2, **params): return paginator.paginate(**params).build_full_result() +# Handle SnapshotCreationPerVolumeRateExceeded separately because we need a much +# longer delay than normal +@AWSRetry.jittered_backoff(catch_extra_error_codes=['SnapshotCreationPerVolumeRateExceeded'], delay=15) def _create_snapshot(ec2, **params): # Fast retry on common failures ('global' rate limits) return ec2.create_snapshot(aws_retry=True, **params) diff --git a/tests/integration/targets/ec2_snapshot/tasks/main.yml b/tests/integration/targets/ec2_snapshot/tasks/main.yml index ea88a8c06af..5a539860f14 100644 --- a/tests/integration/targets/ec2_snapshot/tasks/main.yml +++ b/tests/integration/targets/ec2_snapshot/tasks/main.yml @@ -178,11 +178,6 @@ # that: # - result is changed - # Wait at least 15 seconds between concurrent volume snapshots. - - name: Prevent SnapshotCreationPerVolumeRateExceeded errors - pause: - seconds: 15 - - name: Take snapshot and tag it ec2_snapshot: volume_id: '{{ volume_id }}' @@ -223,6 +218,9 @@ ResourcePrefix: '{{ resource_prefix }}' loop: '{{ range(1, 6, 1) | list }}' loop_control: + # Anything under 15 will trigger SnapshotCreationPerVolumeRateExceeded, + # this should now be automatically handled, but pause a little anyway to + # avoid being aggressive pause: 10 label: "Generate extra snapshots - {{ item }}"