Skip to content
Snippets Groups Projects
Select Git revision
  • 10ff70fc795f46e064d7eb0a9eb78316a07b6cc8
  • main default protected
  • nour2
  • aleks4
  • geno2
  • petri-net-output
  • nour
  • deep-rl-1
  • geno3
  • paula
  • aleks2
  • aleks3
  • Nour
  • geno
  • aleks
15 results

eventlog.py

Blame
  • start-with-vpc.py 1.59 KiB
    import boto3
    
    
    ################################################################################################
    #
    # Configuration Parameters
    #
    ################################################################################################
    
    # place your credentials in ~/.aws/credentials, as mentioned in AWS Educate Classroom,
    # Account Details, AWC CLI -> Show (Copy and paste the following into ~/.aws/credentials)
    
    # !!! you also need to specify an IAM role for this example to able to access S3 !!!
    
    
    # region = 'eu-central-1'
    region = 'us-east-1'
    stackName = 'cloudcomp-counter-demo-stack'
    # keyName = 'srieger-pub'
    keyName = 'vockey'
    roleName = 'LabRole'
    
    ################################################################################################
    #
    # boto3 code
    #
    ################################################################################################
    
    
    client = boto3.setup_default_session(region_name=region)
    cfClient = boto3.client('cloudformation')
    
    templateFile = open("cloudcomp-counter-demo-with-vpc.json", "r")
    templateBody = templateFile.read()
    
    print("Deleting old stack...")
    print("------------------------------------")
    response = cfClient.delete_stack(
        StackName=stackName,
    )
    
    print("creating new stack...")
    print("------------------------------------")
    
    response = cfClient.create_stack(
        StackName=stackName,
        TemplateBody=templateBody,
        Parameters=[
            {
                'ParameterKey': 'paramKeyPair',
                'ParameterValue': keyName
            },
            {
                'ParameterKey': 'paramIamInstanceRole',
                'ParameterValue': roleName
            },
        ],
    )