sfolador/ecs-manage

Easily manage your ECS Cluster with this simple artisan command

1.0 2023-05-06 12:08 UTC

README

68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4543532532304d616e6167652e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d73666f6c61646f722532466563732d6d616e616765267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d4d616e6167652b796f75722b4543532b7461736b732b776974682b612b73696d706c652b4172746973616e2b636f6d6d616e64266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d7465726d696e616c267769647468733d373030

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.