sfolador/ecs-manage

使用这个简单的 artisan 命令轻松管理您的 ECS 集群

1.0 2023-05-06 12:08 UTC

README

使用这个简单的 artisan 命令轻松管理您的 ECS 集群

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

此包允许您使用简单的 artisan 命令轻松管理您的 ECS 集群。

要求

您可以使用此包与 Laravel 10.x 一起使用,并且您应该已安装并配置 AWS CLI。

Please check if your AWS CLI is configured with the correct region and credentials.
Refer to this link: https://docs.aws.amazon.com/cli/v1/userguide/install-macos.html if you need more information on that specific subject.

安装

您可以通过 composer 安装此包

composer require sfolador/ecs-manage

您可以使用以下命令发布配置文件

php artisan vendor:publish --tag="ecs-manage-config"

这是发布配置文件的内容

return [
     
     'environments' => [
        'staging',
        'production',
    ],
    
     'default_terminal' => 'iTerm'
];

用法

php artisan ecs:manage

您将看到类似以下的输出

Select a cluster [mycluster-ecs]:
[0] mycluster-ecs

您应该选择您想要使用的集群。选择集群后,您应该选择一个“环境”

 Select an environment:
  [0] staging
  [1] production

这些选项可以在配置文件中进行自定义,并将作为服务过滤器。选择“环境”后,您将看到匹配所选“环境”的服务列表。

例如,如果您选择了“staging”,服务列表将是

如果您为您的服务有命名约定,这将工作得非常好。

Select a service [sfolador-zero-staging-FARGATE]:
  [0 ] sfolador-zero-staging-FARGATE
  [1 ] sfolador-one-staging-FARGATE
  [2 ] sfolador-two-staging-FARGATE
  [3 ] sfolador-three-staging-EC2

选择一个服务,您将看到匹配所选服务的任务列表

 Select a task [xxxxxxxxxxxxxx]:
  [0] xxxxxxxxxxxxxx

选择任务后,将打开一个终端窗口,并尝试连接到所选任务。终端窗口中运行的命令是

aws ecs execute-command --region SELECTED_AWS_REGION  --cluster SELECTED_CLUSTER --task SELECTED_TASK --command \"/bin/sh\" --interactive

测试

composer test

更新日志

请参阅更新日志以获取有关最近更改的更多信息。

贡献

请参阅贡献指南以获取详细信息。

安全漏洞

请参阅我们的安全策略了解如何报告安全漏洞。

鸣谢

许可证

MIT 许可证(MIT)。请参阅许可证文件以获取更多信息。