Navigate to the S3 console. You might find to your surprise that your account has two S3 buckets:
These buckets were created when we uploaded our CloudFormation templates. AWS needs somewhere to put them, so it has created a bucket for each template. CloudFormation does not delete these buckets when the stack is deleted to prevent accidental deletion of information.
We can delete these buckets though since we will not be needing the templates anymore.
First empty the bucket. Two ways:
- in the Buckets list, select the bucket you want to empty and click Empty OR
- click the name of the bucket to view the contents. Check the box above the list of objects to select them all, then click Delete.
You will have to confirm that you really want to delete all the objects.
An empty bucket can be deleted from the Buckets list by selecting it and clicking Delete. Again you will be asked to confirm this (I guess people used to accidentally delete things and got mad at AWS..)
Now that our list of buckets is empty, we can start from a blank slate and create our own bucket.
- Create bucket
- Choose a name. It has to be globally unique, so maybe try your-name-ddmmyyyy
- Pick a region
- Object ownership: ACLs disabled
- Block public access: block all public access
- Versioning: disable
- No tags
- No encryption
- Create bucket.
Here is the command to create bucket eve-test2-10012022 in the eu-north-1 region:
aws s3api create-bucket --bucket eve-test2-10012022 --region eu-north-1 --create-bucket-configuration LocationConstraint=eu-north-1
Note: if you do not specify region and LocationConstraint, the bucket will get created in us-east-1. This is probably due to some strange historical reason.
This command returns the following:
{
"Location": "http://eve-test2-10012022.s3.amazonaws.com/"
}
Now this shows why bucket names need to be globally unique: they are a part of the DNS name of the bucket.
Here are the two buckets:
Notice the difference in Access? "Objects can be public" does not mean that objects are public - it just means that they might be. They are not explicitly kept from being public. I sound like a politician.
Let's try adding a file to both buckets.
Click the name of either bucket. Then select upload and put an object into the bucket.
An object can be between 0 KB and 5 TB in size. The filetype can be anything: mp3, jpg, docx, iso, pdf, vmdk... to S3 it's just 1's and 0's.
Here is the command to upload file s3_temp_file.txt
to bucket eve-test-10012022
:
aws s3 cp s3_temp_file.txt s3://eve-test-10012022
Empty buckets don't cost anything. You only pay for the objects based on their storage class (topic of the next page) and the object size.
We will need a bucket in a future lab, so please
- empty both buckets
- delete one of them.