Home > Net >  Using command in fargate container from EventBridge
Using command in fargate container from EventBridge

Time:05-25

I have fargate container which has the php prgram.

Then What I want to do is exec command in the container,

it is equivalent to docker command in local.

docker exec -it mycontainer /usr/bin/php mycommand

So, I want to do this from EventBridge (like cron)

Is it possible to do this??

CodePudding user response:

In short:

It is possible to execute command inside container by aws-cli:

aws ecs execute-command  \
    --region $AWS_REGION \
    --cluster ecs-exec-demo-cluster \
    --task ef6260ed8aab49cf926667ab0c52c313 \
    --container nginx \
    --command "/bin/bash" \
    --interactive

Most features that able to run via CLI able to run by using AWS SDK and supported program language.

Any supported language program may be added as AWS Lambda function

Any Lambda may be called by EventBridge

So answer is yes.

Details depends on how you plan to realize code that will be triggered by EventBridge.

  • Related