https://aws.amazon.com/ru/cloud9/
# which node
# /root/.nvm/versions/node/v8.11.3/bin/node
mkdir aws-cloud9
cd aws-cloud9
sudo touch Dockerfile
# Build a Docker image based on the cloud9/ws-nodejs Docker image
# definition for AWS Cloud9.
FROM cloud9/ws-nodejs
# Enable the Docker container to commmunicate with AWS Cloud9 by
# installing SSH.
RUN apt-get update && apt-get install -y openssh-server
# Ensure that Node.js is installed.
RUN apt-get install -y nodejs && ln -s /usr/bin/nodejs /usr/bin/node
# Disable password authentication by turning off the
# Pluggable Authentication Module (PAM).
RUN sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config
# Add the AWS Cloud9 SSH public key to the Docker container.
# This assumes a file named authorized_keys containing the
# AWS Cloud9 SSH public key already exists in the same
# directory as the Dockerfile.
RUN mkdir -p /home/ubuntu/.ssh
ADD ./authorized_keys /home/ubuntu/.ssh/authorized_keys
RUN chown -R ubuntu /home/ubuntu/.ssh /home/ubuntu/.ssh/authorized_keys && \
chmod 700 /home/ubuntu/.ssh && \
chmod 600 /home/ubuntu/.ssh/authorized_keys
# Start SSH in the Docker container.
CMD /usr/sbin/sshd -D
# Update the password to a random one for the user ubuntu.
RUN echo "ubuntu:$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)" | chpasswd
sudo touch authorized_keys
# copy&past key from aws creation ide
echo "<AWS_KEY>" >> ../.ssh/authorized_keys
sudo docker build -t cloud9-image:latest .
# if volume not needed
sudo docker run -d -it --expose 9090 -p 0.0.0.0:9090:22 --name cloud9_<PROJECT_NAME> cloud9-image:latest
# else if volume needed
mkdir ~/<PROJECT_NAME>
# needed 777 right to work with folder, but you can close access to some private files with chmod 600
chmod 777 ~/<PROJECT_NAME>
sudo docker run -d -it --expose 9090 -p 0.0.0.0:9090:22 -v /home/username/project-name:/home/ubuntu/<PROJECT_NAME> --name cloud9_<PROJECT_NAME> cloud9-image:latest
sudo docker exec -it cloud9_<PROJECT_NAME> bash
sudo chmod u=rwx,g=rx,o=rx ~
# on aws page set right settings:
Environment type: Connect and run in remote server (SSH)
User: ubuntu
Host: <IP_OR_HOST>
Port: 9090
# DONE!
# Now open ide from aws site
# disable to install: c9.ide.lambda.docker