From 9c38e8cfd7229927db4d9d465458b77997721da7 Mon Sep 17 00:00:00 2001 From: Sebastian Rieger Date: Sun, 15 May 2022 16:05:19 +0200 Subject: [PATCH] changed default keypair to vockey, as used in AWS Academy Lab docu and terminal, fixed timeout var --- example-projects/demo3-microservice-in-aws.py | 18 +++++++++++---- example-projects/demo4-scale-out-lb-in-aws.py | 22 ++++++++++++++----- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/example-projects/demo3-microservice-in-aws.py b/example-projects/demo3-microservice-in-aws.py index 90541b0..be550b8 100644 --- a/example-projects/demo3-microservice-in-aws.py +++ b/example-projects/demo3-microservice-in-aws.py @@ -18,14 +18,24 @@ ubuntu_image_name = 'ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-2021 # TODO: 18.04, currently still needed for faafo, need to port faafo demo app to 20.04 or higher and python3... # The public key to be used for SSH connection, please make sure, that you have the corresponding private key + +# use existing vockey in AWS Lab env from vocareum, enables login directly +# from the lab's terminal: # +# ssh -i ~/.ssh/labuser.pem ubuntu@ + +keypair_name = "vockey" + +# keypair_name = 'srieger-pub' +# pub_key_file = home + '/.ssh/id_rsa.pub' + # id_rsa.pub should look like this (standard sshd pubkey format): # ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAw+J...F3w2mleybgT1w== user@HOSTNAME -keypair_name = 'srieger-pub' -pub_key_file = home + '/.ssh/id_rsa.pub' - -flavor_name = 't2.nano' +# flavor_name = 't2.nano' +# t2.nano only has 512 MB RAM, pip install will cause out of memory (OOM), install-aws.sh cloud-init script uses swap +# to circumvent this issue, but t2.micro is also cheap and has 1 GB RAM which is sufficient for faafo example +flavor_name = 't2.micro' # default region # region_name = 'eu-central-1' diff --git a/example-projects/demo4-scale-out-lb-in-aws.py b/example-projects/demo4-scale-out-lb-in-aws.py index 5fc3801..f587f05 100644 --- a/example-projects/demo4-scale-out-lb-in-aws.py +++ b/example-projects/demo4-scale-out-lb-in-aws.py @@ -26,14 +26,23 @@ ubuntu_image_name = 'ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-2021 # TODO: 18.04, currently still needed for faafo, need to port faafo demo app to 20.04 or higher and python3... # The public key to be used for SSH connection, please make sure, that you have the corresponding private key + +# use existing vockey in AWS Lab env from vocareum, enables login directly +# from the lab's terminal: # +# ssh -i ~/.ssh/labuser.pem ubuntu@ + +keypair_name = "vockey" + +# keypair_name = 'srieger-pub' +# pub_key_file = home + '/.ssh/id_rsa.pub' + # id_rsa.pub should look like this (standard sshd pubkey format): # ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAw+J...F3w2mleybgT1w== user@HOSTNAME -keypair_name = 'srieger-pub' -pub_key_file = home + '/.ssh/id_rsa.pub' - # flavor_name = 't2.nano' +# t2.nano only has 512 MB RAM, pip install will cause out of memory (OOM), install-aws.sh cloud-init script uses swap +# to circumvent this issue, but t2.micro is also cheap and has 1 GB RAM which is sufficient for faafo example flavor_name = 't2.micro' # default region @@ -297,8 +306,9 @@ def main(): ex_keyname=keypair_name, ex_userdata=userdata_service, ex_security_groups=["services"]) - instance_services = conn.wait_until_running(nodes=[instance_services], timeout=120, ssh_interface='public_ips') + instance_services = conn.wait_until_running(nodes=[instance_services], timeout=timeout, ssh_interface='public_ips') services_ip = instance_services[0][0].private_ips[0] + print(instance_services) ########################################################################### # @@ -330,10 +340,10 @@ def main(): ex_userdata=userdata_api, ex_security_groups=["api"]) - instance_api_1 = conn.wait_until_running(nodes=[instance_api_1], timeout=120, ssh_interface='public_ips') + instance_api_1 = conn.wait_until_running(nodes=[instance_api_1], timeout=timeout, ssh_interface='public_ips') api_1_ip = instance_api_1[0][0].private_ips[0] print("app-api-1 public ip: " + instance_api_1[0][1][0]) - instance_api_2 = conn.wait_until_running(nodes=[instance_api_2], timeout=120, ssh_interface='public_ips') + instance_api_2 = conn.wait_until_running(nodes=[instance_api_2], timeout=timeout, ssh_interface='public_ips') # currently only api_1_ip is used api_2_ip = instance_api_2[0][0].private_ips[0] print("app-api-2 public ip: " + instance_api_2[0][1][0])