Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion python/example_code/ec2/hello/hello_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def hello_ec2(ec2_client):
print("Hello, Amazon EC2! Let's list up to 10 of your security groups:")
try:
paginator = ec2_client.get_paginator("describe_security_groups")
response_iterator = paginator.paginate(MaxResults=10)
response_iterator = paginator.paginate(PaginationConfig={'MaxItems': 10}) # List only 10 security groups.
logging.basicConfig(level=logging.INFO) # Enable logging.
for page in response_iterator:
for sg in page["SecurityGroups"]:
logger.info(f"\t{sg['GroupId']}: {sg['GroupName']}")
Expand Down