INNER CODE UNIT · Python

bucket_exists

miztiik/AWS-Demos · how-to-examples/iam-s3-sqs-sns-video-transcoder.py:275

    def bucket_exists(self, bucket_name):
        """
        Returns ``True`` if a bucket exists and you have access to
        call ``HeadBucket`` on it, otherwise ``False``.
        """
        try:
            self.s3.meta.client.head_bucket(Bucket=bucket_name)
            return True
        except ClientError:
            return False

    def iam_role_exists(self):
        """
        Returns ``True`` if an IAM role exists.
        """
        try:
            self.iam.meta.client.get_role(
                RoleName=self.role_name)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…