Iterators iterators iterators!
Managing lots of CloudFormation stacks can be a pain through the AWS Console. Stacks are paginated so you’ll need to keep clicking that “View more stacks” button until you get to the stack you want. Performing tasks through the AWS PHP SDK makes it a little easier, but you’ll still need to deal with tokens. Take the following code snippet for example: [code lang=php] $client = \Aws\CloudFormation\CloudFormationClient::factory($config); $stackstatus = array('CREATE_COMPLETE'); // First run $result = $client->listStacks(array( 'StackStatusFilter' => $stackstatus, )); $stacks = $result['StackSummaries']; $token = $result['NextToken']; foreach ($stacks as $stack) { echo "$stack[StackName] – $stack[StackStatus]\n"; } // Subsequent runs while ($token != […]
Iterators iterators iterators! Read More »