sfolador/ecs-manage

Easily manage your ECS Cluster with this simple artisan command

1.0 2023-05-06 12:08 UTC

This package is auto-updated.

Last update: 2024-11-16 10:18:45 UTC


README

Easily manage your ECS Cluster with this simple artisan command

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

This package allows you to easily manage your ECS Cluster with a simple artisan command.

Requirements

You can use this package with Laravel 10.x, and you should have the AWS CLI installed and configured.

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.

Installation

You can install the package via composer:

composer require sfolador/ecs-manage

You can publish the config file with:

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

This is the contents of the published config file:

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

Usage

php artisan ecs:manage

you will see an output that looks like this:

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

You should select the cluster you want to use. After selecting a cluster you should select and "environment":

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

These options can be customized in the config file and will act as a filter on services. Once you select an "environment", you will see a list of services that match the selected "environment".

So, for example, if you selected "staging", the list of services will be:

This works very well if you have a naming convention for your services.

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 service and you will see a list of tasks that match the selected service:

 Select a task [xxxxxxxxxxxxxx]:
  [0] xxxxxxxxxxxxxx

Once you select a task, a terminal window will open and will try to connect to the selected task. The command that will launched in the terminal window is:

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

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.