table of contents Local environment 1st day Online environment version 1st day Improve work environment
Online environment, day 2 Create a virtual network
Online environment 3rd day Launch an EC2 instance with Boto3
Online environment 4th day Try running Code-Server in the cloud
Online environment 5th day Launch code-server on Docker
Online environment, day 6 Let's automate
Online environment 7th day Deploy compute on git on EC2
... Online version .. Built with Coompose file
Online .. Try K8S
...
Demon remodeling
Up to the last time, you can use Docker to launch Code-Server on EC Instance.
This time, I will try from compose file to launching to EC2 Instance on github.
--Create
I don't have any new knowledge, so please try to make it. I think it's good to be dirty.
https://github.com/kyorohiro/advent-2019-code-server/tree/master/app/docker_image_uploader_for_ec2
$ git clone https://github.com/kyorohiro/advent-2019-code-server.git
$ cd advent-2019-code-server/remote_cs04/
$ docker-compose build
$ docker-compose up -d
In your browser, open http://127.0.0.1:8443/
.
On Terminal
Terminal
$ pip install -r requirements.txt
$ aws configure
..
..
Create EC2Instance
$ python main.py --create
Get EC2 information
$ python main.py --get
>>>> i-0d1e7775a07bbb326
>>>>
>>>> 3.112.18.33
>>>> ip-10-1-0-228.ap-northeast-1.compute.internal
>>>> 10.1.0.228
>>>> {'Code': 16, 'Name': 'running'}
Access with a browser
It's done !!
$ python main_command.py --stop
I'm stopping EC2 Insntace. You can keep the usage fee low. EBS Storage usage etc. will be charged.
python main_command.py --start
You can resume what you stopped. Note that the IP address will change
#logout from ec2 instance
$ exit
#local code-On the server
$ python main.py --delete
When making it based on EC2, I think that there is nothing to explain after that, just make it.
If possible so far I think it is already possible to place VSCode (Code-Server) on the cloud.
Docker Image, Composefile or whatever, regardless of VSCode You can put it on the cloud.
Next time, we will enter the K8S edition or Fargate edition. I've made it myself until now, We will use what we have to do this.
https://github.com/kyorohiro/advent-2019-code-server/tree/master/remote_cs06
Recommended Posts