Question: Sorry if a silly question.

I have a script that doesn't behave how it's intended even though a condition is met.

My script is something like this:

```sh
    state=$(Substate=running)

    systemctl show -p SubState someservice | while read output
    if [ $output = $state ];
    then
    echo "ok"
    else
    echo "not ok"
    fi 

```

I've tried declaring the state variable in different ways but non seem to work;

```sh
    state=$(Substate=running)
    state=Substate=running
    state="Substate=running"

```

also tried `[ $output = $state ] [ "$output" = "$state" ] [[ ]]` but nothing works.

I think I'm declaring the state variable wrong?

Can anybody point me in the right direction?

Many thanks in advance

Answer: 
I fixed this by enabling auto-assign public IP.

However, to do this, I had to first change from "Capacity provider strategy" -
"Use cluster default", to "Launch type" - "FARGATE". Then the option to enable auto-assign public IP became available in the dropdown in the EventBridge UI.

This seems odd to me, because my default capacity provider strategy for my cluster *is* Fargate. But it is working now.
Need to use a gateway to follow the traffic from ECS to ECR. It can either Internet Gateway or NAT Gateway eventually which would be effecting cost factor.

But where we can resolve this scenario, by creating VPC Endpoints. Which maintains the traffic within the AWS Resources.

Endpoints Required for this would be :
S3 Gateway
ECR
ECS