Prasath G
Prasath G

Reputation: 1

How to check is S3 service is available or not in AWS via CLI?

We have options to :

1. Copy file/object to another S3 location or local path (cp)
2. List S3 objects (ls)
3. Create bucket (mb) and move objects to bucket (mv)
4. Remove a bucket (rb) and remove an object (rm)
5. Sync objects and S3 prefixes

and many more.

But before using the commands, we need to check if S3 service is available in first place. How to do it?

Is there a command like :

aws S3 -isavailable

and we get response like

0 - S3 is available, I can go ahead upload object/create bucket etc.
1 - S3 is not availble, you can't upload object etc. ?

Upvotes: 0

Views: 1503

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 270184

You should assume that Amazon S3 is available. If there is a problem with S3, you will receive an error when making a call with the Amazon CLI.

If you are particularly concerned, then add a simple CLI command first, eg aws s3 ls and throw away the results. But that's really the same concept. Or, you could use the --dry-run option available on many commands that simply indicates whether you would have had sufficient permissions to make the request, but doesn't actually run the request.

It is more likely that you will have an error in your configuration (eg wrong region, credentials not valid) than S3 being down.

Upvotes: 3

Related Questions