Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save azakordonets/669a6e86f1dc802ee4b43739c8933f5c to your computer and use it in GitHub Desktop.
Save azakordonets/669a6e86f1dc802ee4b43739c8933f5c to your computer and use it in GitHub Desktop.
# if you gonna have more then 500 api gateways, then you gonna need to wrap this into the loop and after first 500 you gonna need to pass position parameter to get_rest_apis method
import boto3
client = boto3.client('apigateway')
response = client.get_rest_apis(
limit=500
)
print(f"We have {len(response['items'])} api gateways to process")
for apigateway in response['items']:
print(f"Enabling {apigateway['name']} api gateway tracing")
client.update_stage(
restApiId=apigateway['id'],
stageName='{your-stage-name}',
patchOperations=[
{
'op': 'replace',
'path': '/tracingEnabled',
'value': 'True'
}
]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment