S3 bucket creation is a simple task, the user will require the following to proceed;
Access Key ID: From AWS Console New Admin user
Secret Key: From AWS console New Admin user
Region: From AWS console the region you want S3 bucket to exist
Output format [Table]: Table as it was suggested by system too.
Name for the desired bucket a user wants to create in the AWS s3 bucket console.
Command to check if there are existing files or folder exist in s3 bucket.
aws s3 ls
Command to create s3 bucket using cli
aws s3 mb s3://Demo-Bucket-2023 –region us-east-1
Copying file from Linux to S3 bucket through cli
To copy any file folder we will have to define the copy as “cp“ name of the file which needs to be uploaded and AWS bucket name along with path.
aws s3 cp README.md s3://dem-2023-testo
To upload the same file, but different name
aws s3 cp README.md s3://dem-2023-testo/README-1.md
Deleting S3 bucket through Linux cli
To delete the empty bucket we can use “rb“ command, the bucket must be completely empty prior to deletion. We have to remove all the versioned and un versioned objects before deletion. To delete the version object use the following command
aws s3api delete-object s3://dem-2023-testo/my-object-1 --version-id=my-object-1-id
To delete the un versioned Object use the command.
aws s3 rb s3://dem-2023-testo --force
To delete the S3 bucket use the command
aws s3 rb s3://baz-data --force
Comments
Post a Comment