From 94224c469c0d154c2d1de60ef97734ed6bf6f1e0 Mon Sep 17 00:00:00 2001 From: mikolajpaterka Date: Thu, 26 Jan 2023 20:50:56 +0100 Subject: [PATCH] aws 4 vl2 --- .gitignore | 1 + 4_aws/main.py | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index f43fedc..d763c6f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ ssh.txt /3_2/token.txt tests.ipynb /4_aws/test.ipynb +/4_aws/credencials_aws.py diff --git a/4_aws/main.py b/4_aws/main.py index d71e85a..eca5f88 100644 --- a/4_aws/main.py +++ b/4_aws/main.py @@ -2,13 +2,14 @@ from credencials_aws import aws_access_key_id, aws_secret_access_key, aws_sessio import boto3, time + INDEKS = "s444455" -key_name = f"{INDEKS}-key" -security_group_name = f"{INDEKS}-security_group" -target_group_name = f"{INDEKS}-target_group" -load_balancer_name = f"{INDEKS}-load-balancer" +key_name = f"{INDEKS}-key-4" +security_group_name = f"{INDEKS}-security-group-4" +target_group_name = f"{INDEKS}-target-group-4" +load_balancer_name = f"{INDEKS}-load-balancer-4" user_data = f''' @@ -16,12 +17,12 @@ user_data = f''' sudo yum update -y sudo yum install git -y git clone https://git.wmi.amu.edu.pl/s444455/DPZC_3.git -cd 4_aws/get +cd DPZC_3/4_aws sudo yum install docker -y sudo service docker start sudo usermod -a -G docker ec2-user -docker build -t webservice . -docker run -d -p 80:8080 -t webservice +sudo docker build -t webservice . +sudo docker run -d -p 80:8080 -t webservice ''' if __name__ == '__main__': @@ -32,7 +33,7 @@ if __name__ == '__main__': aws_secret_access_key=aws_secret_access_key, aws_session_token=aws_session_token, ) - + key_pair = ec2.create_key_pair( KeyName=key_name, KeyType='ed25519',