AWS ChatBot not recognising ecs update-service command

0

I am trying to create a command from Slack using AWS ChatBot that enables anyone in the channel to perform some AWS CLI commands, in this case it is ecs update-service. I've created an alias as follows

@aws alias create restart_service ecs update-service --cluster $cluster-name --service $service-name --force-new-deployment --region ap-southeast-2

Then, I was hoping that anyone that run this command

@aws run restart_service --cluster-name cluster-a --service-name service-a

will just right away execute the command and restart the service.

But instead, I received this message as if the AWS ChatBot doesn't understand the command

@slack-user - I'm not sure which AWS service or operation you meant by "ecs update-service --cluster cluster-a --service service-a --force-new-deployment --region ap-southeast-2".
Did you mean one of the following?
ecs update-service --service service-a cluster-a: Modifies the parameters of a service.

Is there any solution to this? Thanks!

1 Risposta
0

Please review the following documentation https://docs.aws.amazon.com/chatbot/latest/adminguide/chatbot-cli-commands.html

As a workaround,

  • you can Create a Lambda function and
  • Create an IAM role for your Lambda function with the necessary permissions to update the ECS service and then
  • Configure AWS ChatBot to allow invoking the Lambda function. This requires adding the necessary permissions to the AWS ChatBot IAM role.
  • Use AWS ChatBot to invoke the Lambda function from Slack, passing the required parameters like cluster-name and service-name.

like the following

@aws lambda invoke --function-name your_lambda_function_name --payload '{"cluster-name": "cluster-a", "service-name": "service-a"}'

profile picture
ESPERTO
con risposta un anno fa
profile picture
ESPERTO
verificato 10 giorni fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande