'''
This version simply starts and stops machines on AWS.
'''
import boto3
import yaml


def createSession():
    #Read configuration
    stream = open("config.yaml")
    conf = yaml.load(stream)
    ACCESS_KEY = conf["id"]
    SECRET_KEY = conf["key"]
    REGION = conf["region"]
    
    session = boto3.session.Session(
        aws_access_key_id=ACCESS_KEY,
        aws_secret_access_key=SECRET_KEY,
        region_name=REGION
    )
    return session

def main():
    # Print list of s3 buckets.
    '''s3 = boto3.resource(
        's3',
        aws_access_key_id=ACCESS_KEY,
        aws_secret_access_key=SECRET_KEY,
        region_name=REGION
    )'''
    session = createSession()
    s3 = session.resource('s3')
    for bucket in s3.buckets.all():
        print(bucket.name)

if __name__ == "__main__":
    main()

@@ -6,279 +6,248 @@
 his 
-version simply starts and stops machines on AWS.%0A'''%0Aimport boto3%0Aimport yaml%0A%0A%0Adef createSession():%0A    #Read configuration%0A    stream = open(%22config.yaml%22)%0A    conf = yaml.load(stream)%0A    ACCESS_KEY = conf%5B%22id%22%5D%0A    SECRET_KEY = conf%5B%22key%22%5D%0A    REGION = conf%5B%22region%22%5D
+file is currently inteded to test aws and boto3 capabilities.%0A'''%0Aimport boto3%0Aimport yaml%0A%0A''' Creates a session using user-provided custom credentials. '''%0Adef createSession():%0A    stream = open(%22config.yaml%22)%0A    conf = yaml.load(stream)
 %0A   
@@ -307,34 +307,34 @@
 cess_key_id=
-ACCESS_KEY
+conf%5B%22id%22%5D
 ,%0A        aw
@@ -349,34 +349,35 @@
 _access_key=
-SECRET_KEY
+conf%5B%22key%22%5D
 ,%0A        re
@@ -382,30 +382,38 @@
 region_name=
-REGION
+conf%5B%22region%22%5D
 %0A    )%0A    r
@@ -431,31 +431,18 @@
 on%0A%0A
-def main():%0A    #
+'''
  Print
+s
  lis
@@ -461,196 +461,41 @@
 ets.
-%0A    '''s3 = boto3.resource(%0A        's3',%0A        aws_access_key_id=ACCESS_KEY,%0A        aws_secret_access_key=SECRET_KEY,%0A        region_name=REGION%0A    )'''%0A    session = createSession()
+ '''%0Adef printS3Buckets(session):
 %0A   
@@ -587,16 +587,91 @@
 .name)%0A%0A
+def main():%0A    session = createSession()%0A    printS3Buckets(session)%0A    %0A
 if __nam

Splits code into functions