With this Terraform script, you can easily deploy a Jupyter Notebook on ECS. I want to refer to this medium post for further explanation.
First, install terraform: https://learn.hashicorp.com/terraform/getting-started/install.html
Initialize terraform within this folder, this will download all dependencies et cetera used by this script.
terraform init
Apply the terraform scripts.
terraform apply -var-file=vars.tfvars
It will ask for a token, which you can use to connect the Jupyter Notebook, you can come up with one yourself.
Enter a value: secret-token
It will ask you to apply the changes, type 'yes'.
Enter a value: yes
The url which you can use will be displayed after the script successfully ran, it will take a minute of 5 to be up and running.
Apply complete! Resources: 8 added, 0 changed, 0 destroyed.
Outputs:
url = jupyter-4vkuf8x0.domainname.com?token=secret-token
When you're done with the jupyter notebook and you want to kill the environment, do:
terraform destroy -var-file=vars.tfvars
It will prompt for the token again, you should enter the token you used on applying.