Ejemplo n.º 1
0
def create_session():
    boto_session = Session()
    boto_session.lazy_register_component('data_loader',
                                         lambda: create_loader())
    if 'REQUESTS_CA_BUNDLE' not in os.environ:
        ca_bundle_path = extract_file_from_jar(
            "botocore/vendored/requests/cacert.pem")
        os.environ['REQUESTS_CA_BUNDLE'] = ca_bundle_path
    return boto_session
Ejemplo n.º 2
0
    def __init__(self, deployed, deployed_application=None):
        self.deployed = deployed
        self.deployed_application = deployed_application

        botocore_session = BotocoreSession()
        botocore_session.lazy_register_component('data_loader',
                                                 lambda: commons.create_loader())

        if deployed.container.type == "aws.Cloud":
            aws_keys_container = deployed.container
        else:
            aws_keys_container = deployed.container.AwsKeys

        self.session = Session(aws_access_key_id=aws_keys_container.accesskey,
                               aws_secret_access_key=aws_keys_container.accessSecret,
                               botocore_session=botocore_session)

        if hasattr(self.deployed, 'region') and self.deployed.region is not None:
            self.ecs_client = self.session.client('ecs', region_name=self.deployed.region, use_ssl=True, verify=False)