aws 4 vl2

This commit is contained in:
mikolajpaterka 2023-01-26 20:50:56 +01:00
parent d19e4dd3d9
commit 94224c469c
2 changed files with 10 additions and 8 deletions

1
.gitignore vendored
View File

@ -4,4 +4,5 @@ ssh.txt
/3_2/token.txt
tests.ipynb
/4_aws/test.ipynb
/4_aws/credencials_aws.py

View File

@ -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',