aws esc windows container pseudoTerminal cloudwatch ouput with strange chars - amazon-ec2

I am running AWS ESC (Windows EC2).
The container with -t runs well on my machine. The task definition has pseudoTerminal: true so that it will run -t on Windows EC2.
The output logged into CloudWatch log group has strange chars beside the correct data.
Note: the output is fine when running without -t (pseudoTerminal: null)

Looks like my container output using the xterm control sequences.
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Definitions

Related

Bash- Running aws ec2 run-instances in background

How can i run the command aws ec2 run-instances in bash (mac os) so it will run in the background? (Right now when i run it it is in interactive mode in which i need to scroll until the end)
That command actually executes and completes immediately.
However, the AWS CLI is using a pager to show you the output. You can modify this behaviour by either requesting less information to be returned by using --query, or by removing the pager.
To remove the pager, add this to your ~/.aws/config file:
[default]
cli_pager=
This will cause all output to scroll up the screen without waiting for user input.
For more details, see: Using AWS CLI pagination options - AWS Command Line Interface

Is there a docker log viewer or debug mode for windows?

It seems the Docker Desktop is always being updated and often with bugs so it is not working as it was previously. The default install on Windows is mostly a black box and you can look at the GUI, but it isn't very helpful in learning what is happening or where it is in starting when it says "restarting" for example. Preface of the question is that Docker is targeted towards developers, but then they wrap it into this dumbed down GUI that makes the service a black box to developers. I would prefer to start it some sort of debug mode in a console window and only when I want to interact via the GUI use those features. Is there a way to use docker from a more programmer friendly console interface on Windows?
Open an elevated command prompt and then run sc.exe c docker to get the current command line for docker service.
From the output of the above command take the BINARY_PATH_NAME and modify it using the below steps.
1. Escape each " with \
2. Add -D at the end
3. Keep the whole command in " "
After modifying it run the command and then restart the docker service.
Example
Let's say BINARY_PATH_NAME : "C:\Proram Files\Docker\dockerd.exe" --run-service
After modifying it needs to be like this
sc.exe config docker binpath= "\"C:\Program Files\Docker\dockerd.exe\" --run-service -D"
After executing the above commands restart the docker service.
sc.exe stop docker
sc.exe start docker

aws cli autoscaling command doesn't return to shell promot

In Macbook pro, iterm2 with aws cli, shell zsh.
When running below command, the shell goes to an empty screen with "(END)" on the top left corn. I have to press "q" to exit to get back to shell prompt.
aws autoscaling update-auto-scaling-group --auto-scaling-group-name xxx --desired-capacity 1
This is very annoying. How can I change it so that the command just return back to normal shell promot?
Not all aws cli command has this same behavior. Like "aws s3 ls" runs ok.
Thanks.
The AWS CLI v2 has the option to specify a pager to handle output that goes longer than one screen.
If you wish to display all output with no pagination, edit the ~.aws/config file and insert:
[default]
cli_pager=
See: AWS CLI version 2 uses a paging program for all output by default

How to access a Docker container on the host by a name (not IP)?

I want to run MS SQL server (docker image: microsoft/mssql-server-windows-developer) in a docker container. Using Windows on the host and the container. Afterwards, the database should be accessible from the host (using SQL Management Studio) by a useful, name (so that the instructions can be re-used). However, docker generates a seemingly random IP, which is not as useful, especially as it resets on every call to run.
So, I would like to give the container a hostname that is accessible from the host machine (e.g. by SQL Management Studio). I'd like to avoid a mere IP here, but it would suffice, if no better solution presents itself.
Creating a network in docker did not work, as this functionality apparently is only supported under Linux.
--network-alias also failed.
The run command looks like this:
docker run -d -p 1433:1433 -e sa_password=1234qwerT -e ACCEPT_EULA=Y --name docker_sql microsoft/mssql-server-windows-developer
This is very similar to this question here: How to get a Docker container's IP address from the host?
I think you can achieve what you want by way of a 2 step process:
Obtain the container id for your container as part of your docker run command.
Use docker inspect to get the container's IP address.
If you really don't want to use the IP address, then you can always add the IP address to your hosts file, but simply using the IP address as a shell variable should be almost as useful.
So, for example, from a bash shell:
CID=$(docker run -d ubuntu /bin/sh -c 'while /bin/true; do sleep 10 ; done')
IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $ID)
Now you can use $IP within scripts as you see fit. (Substitute the CID=... line with whatever docker run command you are using to start your container).
As per bluescores' comment and stumbling upon this related question, I tried and verified that connecting to localhost is possible - so there actually is no need to configure a name for the container-sql-server or to configure its IP.
The general problem might persist for other applications, but for what I want to achieve currently, localhost will suffice.

Start-Up script for a running GCE instance

I just tried to set up a small start-up script for a running GCE instance. I added a custom meta-data with the key startup-script and value
#! /bin/bash
vncserver -geometry 1920x1080
However, it doesn't seem to be taken into account when I restart the instance. Moreover, trying to execute sudo google_metadata_script_runner --script-type startup doesn't give any result neither... What am I doing wrong?

Resources