Created
          September 17, 2019 17:46 
        
      - 
      
 - 
        
Save shubhamwagh/8dd53aa26cb86f475ce9366055074ee8 to your computer and use it in GitHub Desktop.  
    AWS s3 bucket delete and upload
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import boto3 | |
| session = boto3.Session( | |
| aws_access_key_id='AWS_ACCESS_KEY_ID', | |
| aws_secret_access_key='AWS_SECRET_KEY', | |
| ) | |
| s3 = session.resource('s3') | |
| bucket = s3.Bucket('bucket-name') | |
| bucket.objects.all().delete() | |
| s3.meta.client.upload_file(Filename='filename-with-path', Bucket='qbot.co.robot.software.deployment.mk7', Key='only-filename-in-the-bucket') | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment