Browse Source

changed default keypair to vockey, as used in AWS Academy Lab docu and terminal, fixed timeout var

master
Sebastian Rieger 3 years ago
parent
commit
9c38e8cfd7
  1. 18
      example-projects/demo3-microservice-in-aws.py
  2. 22
      example-projects/demo4-scale-out-lb-in-aws.py

18
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... # 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 # 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@<public-ip>
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): # id_rsa.pub should look like this (standard sshd pubkey format):
# ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAw+J...F3w2mleybgT1w== user@HOSTNAME # 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 # default region
# region_name = 'eu-central-1' # region_name = 'eu-central-1'

22
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... # 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 # 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@<public-ip>
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): # id_rsa.pub should look like this (standard sshd pubkey format):
# ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAw+J...F3w2mleybgT1w== user@HOSTNAME # 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' flavor_name = 't2.micro'
# default region # default region
@ -297,8 +306,9 @@ def main():
ex_keyname=keypair_name, ex_keyname=keypair_name,
ex_userdata=userdata_service, ex_userdata=userdata_service,
ex_security_groups=["services"]) 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] services_ip = instance_services[0][0].private_ips[0]
print(instance_services)
########################################################################### ###########################################################################
# #
@ -330,10 +340,10 @@ def main():
ex_userdata=userdata_api, ex_userdata=userdata_api,
ex_security_groups=["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] api_1_ip = instance_api_1[0][0].private_ips[0]
print("app-api-1 public ip: " + instance_api_1[0][1][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 # currently only api_1_ip is used
api_2_ip = instance_api_2[0][0].private_ips[0] api_2_ip = instance_api_2[0][0].private_ips[0]
print("app-api-2 public ip: " + instance_api_2[0][1][0]) print("app-api-2 public ip: " + instance_api_2[0][1][0])

Loading…
Cancel
Save