AWS Cloudformation along with SSM Run Command error

0

I am trying to run the following commands like this:-

RunCommandAssociation2:
    Type: 'AWS::SSM::Association'
    Properties:
      Name: 'AWS-RunShellScript'
      Targets:
        - Key: InstanceIds
          Values:
            - !Ref Instance2
      Parameters:
        commands:
          - availability_zone=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone)
          - region=${availability_zone::-1}
          - aws ssm get-parameter --name /my-stack/my-parameter --query 'Parameter.Value' --output text --region "$region" >> /home/ec2-user/ip.txt
          - seed_hosts=$(aws ssm get-parameter --name /my-stack/my-parameter --query 'Parameter.Value' --output text --region "$region")
          - priv_ip=$(curl http://169.254.169.254/latest/meta-data/local-ipv4)
          - sudo docker run -it --privileged -p 9200:9200 -p 9300:9300 -e discovery.type=multi-node -e "cluster.name=my-elasticsearch-cluster" -e ELASTIC_PASSWORD=elastic -e ES_JAVA_OPTS="-Xms1g -Xmx1g" -e node.name="node-2" -e discovery.seed_hosts=["$seed_hosts"] -e network.host="0.0.0.0" -e node.roles=[master,data,ingest] -e cluster.initial_master_nodes=[node-1,node-2,node-3] -e network.publish_host="$priv_ip" -e xpack.security.enabled=false elasticsearch:8.7.0

To see the output, I ran these commands using AWS SSM run command UI and getting this as output:-

% Total % Received % Xferd Average Speed Time Time Time Current

Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 12 100 12 0 0 20547 0 --:--:-- --:--:-- --:--:-- 12000

the input device is not a TTY

failed to run commands: exit status 1

Can anyone please help me understand, what could be the issue? Thanks in advance!

2 Antworten
0
Akzeptierte Antwort

Hi,

This is due to option -it in docker command

Look at answer #1 of https://stackoverflow.com/questions/43099116/error-the-input-device-is-not-a-tty

Best,

Didier

profile pictureAWS
EXPERTE
beantwortet vor 9 Monaten
0
profile picture
beantwortet vor 9 Monaten
  • I am running all the commands mentioned above in commands section.

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen