Upload file to S3 Bucket using Boto3
How to upload files to S3 using Boto3, either with the high-level s3 resource or the low-level s3 client.
Upload file to S3 Bucket with the AWS CLI
The simplest form of using the AWS CLI to upload a file to an S3 bucket is:
aws s3 cp test.txt s3://bucket-name
A neat trick is that you can pipe the output of a shell command to a file on S3, for example:
find . | aws s3 cp - s3://bucket-name/test.txt
IAM
To be able to upload files, you need an IAM role that has at least the following policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowUploadFileToS3Bucket",
"Effect": "Allow",
"Action": [
"s3:PutObject"
],
"Resource": [
"arn:aws:s3:::bucket-name/*"
]
}
]
}
Create S3 Bucket with the AWS CLI
The simplest form of using the AWS CLI to create an S3 bucket is:
aws s3 mb s3://bucket-name
You can optionally specify the region:
aws s3 mb s3://bucket-name --region eu-west-1
If you don't specify the region, the default is us-east-1
(N. Virginia).
IAM
To be able to create buckets, you need an IAM role that has at least the following policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowCreateS3Bucket",
"Effect": "Allow",
"Action": [
"s3:CreateBucket"
],
"Resource": [
"arn:aws:s3:::*"
]
}
]
}
Back-end Validation for Django Model Field Choices
In Django, you can provide a list of values that a field can have when creating a model. This post shows a way to validate the values passed which creating a new instance or saving an existing one.
Single-App Django Project Anatomy
With all the magic that comes packaged within Django, it's easy to forget that the code of a Django project is as malleable as any other Python project's code. This post shows how to simplify the structure of a Django project, when you will only ever have a single app.
AWS
Non-Certification Training
The AWS Category of CBT Nuggets has both certification and non-certification training material.
Certifications
Useful stuff:
- Adrian Cantrill - How to pass AWS Certifications
- AWS YouTube Channel
- AWS SubReddit
- AWS Whitepapers
- AWS Certification FAQs
AWS Certified Solutions Architect - Associate
Tests your technical expertise in designing and deploying scalable, highly available, and fault tolerant systems on AWS. Meant for anyone with experience designing distributed applications and systems on the AWS platform.
Useful stuff:
- Certification Home Page
- Exam Blueprint (PDF)
- Sample Questions (PDF)
Training material:
- CBT Nuggets - AWS: Certified Solutions Architect - Associate (2013, video, paid)
- udemy - AWS Certified Solutions Architect - Associate 2016 (video, paid)
- AWS Technical Essentials (instructor-led, paid)
- Architecting on AWS (instructor-led, paid)
- Whitepapers:
- AWS Architecture Center
- AWS Certified Solutions Architect Official Study Guide: Associate Exam (book, paid)
- Certification Preparation Resource Guide (see the Solutions Architect - Associate tab)
- Qwiklabs Exam Prep
AWS Certified Solutions Architect - Professional
Tests your advanced technical skills and experience in designing distributed applications and systems on the AWS platform. Meant for an AWS Certified Solutions Architect - Associate with two or more years hands-on experience designing and deploying cloud architecture on AWS.
Useful:
- Adrian Cantrill - Passing the AWS Professional Solutions Architect Exam
- Nick Triantafillou - AWS Professional Solution Architect Certification Tips
AWS Certified Developer - Associate
Tests your technical expertise in developing and maintaining applications on the AWS platform. Meant for anyone with one or more years of hands-on experience designing and maintaining an AWS-based application plus in-depth knowledge of at least one high-level programming language.
AWS Certified SysOps Administrator - Associate
Tests your technical expertise in deployment, management, and operations on the AWS platform. Meant for anyone with one or more years of hands-on experience operating AWS-based applications.
AWS Certified DevOps Engineer - Professional
Tests your technical expertise in provisioning, operating, and managing distributed application systems on the AWS platform. Meant for achieved AWS Certified Developer - Associate or AWS Certified SysOps Administrator - Associate. Two or more years’ experience provisioning, operating, and managing AWS environments.
Useful stuff:
- Adrian Cantrill - Passing the AWS DEVOPS Engineer Professional Exam
- Nick Triantafillou - AWS Professional DevOps Engineer Certification Tips
AWS Certified Advanced Networking - Specialty
Tests advanced technical skills and experience in designing and implementing AWS and hybrid IT architectures at scale. This exam is intended for individuals who perform complex networking tasks.
AWS Certified Security - Specialty
Tests ability in the area of security as it pertains to design, implementation, and troubleshooting. The exam is intended for individuals who perform a Security Specialist role.
Useful stuff:
AWS Certified Big Data - Specialty
Tests technical skills and experience in designing and implementing AWS services to derive value from data. The exam is for individuals who perform complex Big Data analyses.
Ad Hoc Data Analysis From The Unix Command Line
I am mirroring the book Ad Hoc Data Analysis From The Unix Command Line from Wikibooks, at Books / Ad Hoc Data Analysis From The Unix Command Line.
Control VLC with Python
VLC is an amazing media player, or rather a media-related Swiss army knife. It has a surprising number of different control interfaces, some of which allow access over a network, such as the HTTP, Telnet and RC interfaces. It also has a Python API but just looking at the documentation is terrifying...