Wednesday, 15 February 2023

AWS Troubleshooting

CloudFormation stack stuck in an IN_PROGRESS state

AWS Docs For Troubleshooting

Here is an example

1. one stack is stuck at UPDATE_IN_PROGRESS
2. click resource tab and I can see AWS::ECS::Service is stuck in UPDATE_IN_PROGRESS
3. Go to ECS and find that service and click Logs tab
4. show get something from logs

ec2-user does not have permission to access mysql log file

After log into a EC2 machine, I try to access /vol/mysql/data/my_logs.txt. However, I get a permission deny.

# see all users in machine
vi /etc/passwd

# switch to root
sudo su - root

# now can see log
vi /vol/mysql/data/my_logs.txt

Wednesday, 8 February 2023

Access Container On AWS Fargate

Here is the documentation for Access Container On Fargate

#!/bin/bash

# if see error, most likely task id is changed because of new build
aws ecs execute-command \
--region us-west-1 \
--cluster my-ecs-microservice \
--task 709909fdf605c4d7f9c3c206af862abc \
--container sandbox-contauner-foo-1 \
--command "/bin/bash"  --interactive

Find Target Group of A ECS Service

  • Click that service
  • Click network tab