Forrest logo
back to the aws tool

aws-s3api:tldr:2f416

aws-s3api: Add an object to a bucket.
$ aws s3api put-object --bucket ${bucket_name} --key ${object_key} --body ${filename}
try on your machine

This command uses the AWS Command Line Interface (CLI) to upload a file to an S3 bucket. Here's how the command is structured:

  • aws s3api put-object is the command to put an object (file) in an S3 bucket using the AWS S3 API.
  • --bucket ${bucket_name} specifies the name of the S3 bucket where you want to upload the file. You need to replace ${bucket_name} with the actual name of the bucket.
  • --key ${object_key} specifies the key or path of the object (file) within the bucket. You need to replace ${object_key} with the desired key.
  • --body ${filename} specifies the filename or the path to the file you want to upload. You need to replace ${filename} with the actual filename or path.

For example, if you have an S3 bucket named "my-bucket" and want to upload a file named "example.txt" to the root of the bucket, the command would be:

aws s3api put-object --bucket my-bucket --key example.txt --body example.txt

This command will upload the "example.txt" file to the "my-bucket" S3 bucket.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the aws tool