aws_access_key_id="ASIA47BSNPAUXFZ4T47L" aws_secret_access_key="wvB7oGz94O9j/tLhsTxRjfqmOFsTUctujm1kQioX" aws_session_token="FwoGZXIvYXdzECcaDLqPCWJkmkN46SLS3yLDAR7y4YnKdvWiPKmi0URNSk0ftfYJenKox99GuNk7ukXYJK076N4kN+XzUxaCoyh/N10rQawrqdk2+C5X8UZ774eV02cprw5HI7geB11hTafb03jp0zawLoAjbGKj+2Tyuaxxpmyw3clijyie5uRAWhgyl2rn42UgDkpd8Cr58kQymvVVL60QGPbCEMrij9+/ZFsmanoNlg8DXhpkxsX5ISdvhFTlOCBM5hzFSIIsr+M5DJlDjZIK/fGZK2fYeZZYQ6xTgijkmt+eBjItmJhbCtRcFJZu+nxtNM2f2r15czCLz2bLGBX1+TH4/pd68UujBAvdDWdvuhV+" VPC="vpc-0c8e1d7baf89a7991" ID="s444018" import boto3 ec2 = boto3.resource( 'ec2', region_name='us-east-1', aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key, aws_session_token=aws_session_token, ) key_pair = ec2.create_key_pair( KeyName=ID+'-KEY-PAIR', KeyType='ed25519', KeyFormat='pem', ) security_group = ec2.create_security_group( Description=ID+'-GROUP', GroupName=ID+'-GROUP', VpcId=VPC ) inbound_rules = security_group.authorize_ingress( GroupId=security_group.group_id, CidrIp='0.0.0.0/0', IpProtocol='tcp', FromPort=80, ToPort=80 ) instances = ec2.create_instances( ImageId='ami-0b5eea76982371e91', MinCount=1, MaxCount=1, InstanceType='t2.micro', KeyName=key_pair.name, UserData=f''' #!/bin/bash sudo yum update -y sudo yum install git -y git clone https://git.wmi.amu.edu.pl/s444376/DPZC_Ola.git cd DPZC_Ola/Zadanie_5.2_5.3 sudo yum install docker -y sudo service docker start sudo usermod -a -G docker ec2-user docker build -t invoice . docker run -d -p 80:8000 -t invoice ''', SecurityGroups=[security_group.group_name] )