/** * ScheduledActionを更新する * * @return void **/ private function _updateScheduledAction() { try { $options = array('AutoScalingGroupName' => 'ModernAdultMidnightCrawlerGroup', 'ScheduledActionName' => 'ModernAdultMidnightCrawlerSchedule', 'Recurrence' => '55 10,12 * * *', 'MinSize' => 1, 'MaxSize' => 1); $this->as->UpdateScheduledAction($options); } catch (\Exception $e) { throw $e; } }
/** * コマンドの実行 * * @param array $params パラメータ配列 * @return void **/ public function execute(array $params) { try { $options = array('AutoScalingGroupName' => 'ModernAdultMidnightCrawlerGroup', 'MinSize' => 0, 'MaxSize' => 0, 'DesiredCapacity' => 0); $as = new AutoScaling(); $as->updateAutoScalingGroup($options); } catch (\Exception $e) { $this->errorLog($e->getMessage()); } }
/** * 新しいLaunchConfigurationを生成する * * @param string $name * @return void **/ private function _createLaunchConfiguration($name) { $user_data = file_get_contents(ROOT . '/data/config/CrawlerCloudConfig.txt'); $user_data = base64_encode($user_data); $options = array('LaunchConfigurationName' => $name, 'ImageId' => $this->ami_id, 'UserData' => $user_data, 'SecurityGroups' => array('sg-e8b77b8d'), 'InstanceType' => Aws\Ec2\Enum\InstanceType::T2_MICRO); $this->as->createLaunchConfiguration($options); }