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 Answer
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
EXPERT
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions