import boto3
      
      def upload_file(local_path, remote_name):
        """
        Upload a file to S3
        :param local_path: local path to the file
        :param remote_name: path on the local bucket
        """
        client = boto3.client('s3',
                              region_name='aws_region', #AWS region
                              aws_access_key_id="access_key",
                              aws_secret_access_key="secret_key")
        client.upload_file(local_path, "bucket_name", remote_name)
      
      Python language logo
      your recipe card header background

      Upload a file in S3

      aws
      boto3
      AWS and boto3 recipes for Python

      Your AWS access and secret keys must be stored as environment variables as specified in the boto documentation

      Library: boto3

      Shortcut: aws.s3

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.