Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cloud-computing-msc-ai-examples
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sebastian Rieger
cloud-computing-msc-ai-examples
Commits
4c299318
Commit
4c299318
authored
May 8, 2021
by
Sebastian Rieger
Browse files
Options
Downloads
Patches
Plain Diff
changed aws demo3 to be compatible with AWS Educate classroom
parent
6e2b8dc1
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
example-projects/demo3-microservice-in-aws-destroy.py
+16
-7
16 additions, 7 deletions
example-projects/demo3-microservice-in-aws-destroy.py
example-projects/demo3-microservice-in-aws.py
+22
-13
22 additions, 13 deletions
example-projects/demo3-microservice-in-aws.py
with
38 additions
and
20 deletions
example-projects/demo3-microservice-in-aws-destroy.py
+
16
−
7
View file @
4c299318
...
...
@@ -13,9 +13,13 @@ from libcloud.compute.types import Provider, NodeState
# default region
# region_name = 'eu-central-1'
region_name
=
'
us-east-2
'
# region_name = 'ap-south-1'
# AWS Educate only allows us-east-1 see our AWS classroom at https://www.awseducate.com
# e.g., https://www.awseducate.com/student/s/launch-classroom?classroomId=a1v3m000005mNm6AAE
region_name
=
'
us-east-1
'
def
main
():
###########################################################################
...
...
@@ -24,10 +28,14 @@ def main():
#
###########################################################################
access_id
=
getpass
.
win_getpass
(
"
Enter your access_id:
"
)
secret_key
=
getpass
.
win_getpass
(
"
Enter your secret_key:
"
)
# access_id = "AXY..."
# secret_key = "j1zomy61..."
# see AWS Educate classroom, Account Details
# access_id = getpass.win_getpass("Enter your access_id:")
# secret_key = getpass.win_getpass("Enter your secret_key:")
# session_token = getpass.win_getpass("Enter your session_token:")
access_id
=
"
ASIAU...
"
secret_key
=
"
7lafW...
"
session_token
=
"
IQoJb3JpZ...EMb//...
"
###########################################################################
#
...
...
@@ -38,6 +46,7 @@ def main():
provider
=
get_driver
(
Provider
.
EC2
)
conn
=
provider
(
access_id
,
secret_key
,
token
=
session_token
,
region
=
region_name
)
###########################################################################
...
...
@@ -63,7 +72,7 @@ def main():
# if we see any demo instances still running continue to wait for them to stop
if
instance
.
name
in
[
'
all-in-one
'
,
'
app-worker-1
'
,
'
app-worker-2
'
,
'
app-worker-3
'
,
'
app-controller
'
,
'
app-services
'
,
'
app-api-1
'
,
'
app-api-2
'
]:
if
instance
.
state
.
value
is
not
'
terminated
'
:
if
instance
.
state
.
value
!=
'
terminated
'
:
nodes_still_running
=
True
print
(
'
There are still instances running, waiting for them to be destroyed...
'
)
...
...
This diff is collapsed.
Click to expand it.
example-projects/demo3-microservice-in-aws.py
+
22
−
13
View file @
4c299318
...
...
@@ -23,10 +23,14 @@ pub_key_file = '~/.ssh/id_rsa.pub'
flavor_name
=
'
t2.nano
'
# default region
region_name
=
'
eu-central-1
'
# region_name = 'us-east-2'
# region_name = 'eu-central-1'
# region_name = 'ap-south-1'
# AWS Educate only allows us-east-1 see our AWS classroom at https://www.awseducate.com
# e.g., https://www.awseducate.com/student/s/launch-classroom?classroomId=a1v3m000005mNm6AAE
region_name
=
'
us-east-1
'
def
main
():
###########################################################################
...
...
@@ -35,10 +39,14 @@ def main():
#
###########################################################################
access_id
=
getpass
.
win_getpass
(
"
Enter your access_id:
"
)
secret_key
=
getpass
.
win_getpass
(
"
Enter your secret_key:
"
)
# access_id = "AXY..."
# secret_key = "j1zomy61..."
# see AWS Educate classroom, Account Details
# access_id = getpass.win_getpass("Enter your access_id:")
# secret_key = getpass.win_getpass("Enter your secret_key:")
# session_token = getpass.win_getpass("Enter your session_token:")
access_id
=
"
ASIAU...
"
secret_key
=
"
7lafW...
"
session_token
=
"
IQoJb3JpZ...EMb//...
"
###########################################################################
#
...
...
@@ -49,6 +57,7 @@ def main():
provider
=
get_driver
(
Provider
.
EC2
)
conn
=
provider
(
access_id
,
secret_key
,
token
=
session_token
,
region
=
region_name
)
###########################################################################
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment