Python code base: Simple S3 project - Create an S3 bucket and upload an image file.

 


This simple tutorial is to help learn:

- Initialise a Git repository in the current working directory (# git init) and set up basic global configurations. 

- Add and stage specific files or all files for commit in the local Git respository.

- Push local changes to remote Github repository to sync with local changes.

- Create an S3 bucket in a specified AWS region.

- Upload an image file to the newly created S3 bucket.

- Verify successful upload by manually checking the S3 bucket contents and/or handling any errors.

- Ask for user input when setting up global configurations for AWS credentials to avoid hard-coding credentials into the project.


Code Base


Use Git commands to push the main.py file to the remote Github repository:

# Initialise the repository
- git init 

# Set up global configurations:
- git config --global user.name "<user_name<"
- git config --global user.email "<email>"

# Create a connection between a local git repository and the main remote repository:
- git remote add origin https://github.com/<username>/project.git

# Add specific files or all the files to the staging area:
- git add .\<specific-file-name.jpg> OR to add all the file #git add .

# Commit the files with a message which describes the changes:
- git commit -m "Initial commit or added specific files."

# Check staging area:
- git status

# Push files to remote repository:
- git push -u origin master







Comments

Popular posts from this blog

Developer's Arsenal: How HashiCorp unites cloud securite and upholds the AWS Well-Architected Framework when implementing Policy as Code using Sentinel One.

Python script (2024): Learn how to manage secure storage in AWS using S3 lifecycle configurations.

C++ code base - Cloud provider services menu using if/else, switch/case. 2023.