c0ntax/aws-ec2-check-tag
Composer 安装命令:
composer require c0ntax/aws-ec2-check-tag
包简介
A very simple service that pulls the tags for a given instance to see if a particular key = a particular value.
README 文档
README
A very simple library that checks that, for the EC2 instance that this is run on, does a key === a certain value.
Introduction
This was built to scratch a particular itch where I only wanted cron commands and other services to run on one of a set of EC2 instances. This way you can deploy one AMI for a set of load balanced machines and simply tag one of them that you want to execute something on. For example, say we have 3 instances running the code base, but we only want a particular bit of code to run on one of them. Simply set a tag for that instance such as
RunHere: True
And then all you need to do so check that RunHere has been set to True
Usage
Using the above example, you could use the following code:
use C0ntax\Aws\Ec2\CheckTag\Exceptions\KeyNotFoundException; use C0ntax\Aws\Ec2\CheckTag\Exceptions\NotOnEc2InstanceException; public function doSomething() { try { if (!$this->getCheckService()->check('RunHere', 'True')) { return; } } catch (NotOnEc2InstanceException $exception) { // This is probably running on a local instance so we might want to allow this to run // (i.e. we are just going to catch and ignore the exception) } catch (KeyNotFoundException $exception) { // The 'RunHere' key was not found. It's up to you how you've implimented it. It's probably not an error in most cases // It just means that you don't want to run anything here return; } print 'I am doing something'; }
c0ntax/aws-ec2-check-tag 适用场景与选型建议
c0ntax/aws-ec2-check-tag 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.36k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 08 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「tags」 「aws」 「ec2」 「instance」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 c0ntax/aws-ec2-check-tag 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 c0ntax/aws-ec2-check-tag 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 c0ntax/aws-ec2-check-tag 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
AWS SDK for PHP - Use Amazon Web Services in your PHP project
A powerfull cacher based on laravels file cache driver
Phalcon PHP Meta tags service
This package includes a script and fail2ban configuration that allows you to use fail2ban when utilizing AWS elastic load balancer (ELB) and an apache webserver.
This library reads parameters from AWS Parameter Store. It supports a path prefix, an optional shared context and multiple profiles. Returns an multi dimensional array of string|int|float|bool. Integrates directly with zendframework/zend-config-aggregator.
Elastic Driver for Laravel Scout
统计信息
- 总下载量: 2.36k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2021-08-24