How to use the aioboto3.client function in aioboto3

To help you get started, we’ve selected a few aioboto3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github awslabs / sagemaker-debugger / tests / analysis / integration_testing_rules.py View on Github external
async def del_folder(bucket, keys):
    loop = asyncio.get_event_loop()
    client = aioboto3.client("s3", loop=loop)
    await asyncio.gather(*[client.delete_object(Bucket=bucket, Key=key) for key in keys])
    await client.close()
github terrycain / aioboto3 / tests / test_basic.py View on Github external
async def test_getting_client(event_loop):
    """Simple getting of client."""
    aioboto3.DEFAULT_SESSION = None

    async with aioboto3.client('ssm', loop=event_loop, region_name='eu-central-1') as client:
        assert isinstance(client, AioBaseClient)
github alanjds / celery-serverless / celery_serverless / invoker.py View on Github external
async def _func():
                async with aioboto3.client('lambda') as cli:
                    res = await cli.invoke(**invoke_options)
                return res
            future = run_aio_on_thread(_func())
github snowflakedb / SnowAlert / src / connectors / utils.py View on Github external
async def aio_sts_assume_role(src_role_arn, dest_role_arn, dest_external_id=None):
    session_name = ''.join(random.choice('0123456789ABCDEF') for i in range(16))
    async with aioboto3.client('sts') as sts:
        src_role = await sts.assume_role(
            RoleArn=src_role_arn, RoleSessionName=session_name
        )
        async with aioboto3.Session(
            aws_access_key_id=src_role['Credentials']['AccessKeyId'],
            aws_secret_access_key=src_role['Credentials']['SecretAccessKey'],
            aws_session_token=src_role['Credentials']['SessionToken'],
        ).client('sts') as sts_client:
            sts_role = await (
                sts_client.assume_role(
                    RoleArn=dest_role_arn,
                    RoleSessionName=session_name,
                    ExternalId=dest_external_id,
                )
                if dest_external_id
                else sts_client.assume_role(
github terrycain / aioboto3 / aioboto3 / s3 / cse.py View on Github external
async def setup(self):
        self._kms_client = aioboto3.client('kms', **self._kms_client_args)
github terrycain / aioboto3 / aioboto3 / s3 / cse.py View on Github external
async def setup(self):
        if sys.version_info < (3, 7):
            self._loop = asyncio.get_event_loop()
        else:
            self._loop = asyncio.get_running_loop()

        self._s3_client = aioboto3.client('s3', **self._s3_client_args)
        await self._crypto_context.setup()