Skip to content

Instantly share code, notes, and snippets.

@mryoshio
Created March 31, 2015 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mryoshio/95289dfa2265923b864d to your computer and use it in GitHub Desktop.
Save mryoshio/95289dfa2265923b864d to your computer and use it in GitHub Desktop.
How to use PagebleResponse in AWS SDK for Ruby version 2
require 'aws-sdk'
REGION = 'ap-northeast-1'
cloudwatch = Aws::CloudWatch::Client.new(region: REGION)
res = cloudwatch.describe_alarms
while true
res.metric_alarms.each do |al|
# some logic for each alarm
end
if res.last_page?
break
else
res = res.next_page
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment