element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Connected Cloud Challenge
  • Challenges & Projects
  • Design Challenges
  • Connected Cloud Challenge
  • More
  • Cancel
Connected Cloud Challenge
Blog AWS Management (Blog #3)
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: neuromodulator
  • Date Created: 28 Apr 2020 2:28 AM Date Created
  • Views 959 views
  • Likes 3 likes
  • Comments 0 comments
Related
Recommended

AWS Management (Blog #3)

neuromodulator
neuromodulator
28 Apr 2020

AWS Management

 

AWS provides several alternatives to manage their services: the AWS Management Console, the AWS Command Line Interface (CLI) and the SDK (available in C++, Go, Java, JavaScript, .NET, Node.js, PHP, Python and Ruby).

 

To show how these methods compare to each other I decided to list my S3 Buckets and objects stored in a Bucket using the console, the CLI and the Python SDK. The Amazon Simple Storage Service (S3) is an object storage service, and before performing the listing operations, I had to create a Bucket and upload some files to it.

 

Lets see how the different management interfaces compare to each other:

 

 

The AWS Management Console interface

 

To check available Buckets, I selected the S3 service, and a list showed up:

 

image

 

 

To check the "smartcage" Bucket, I clicked it and got its content:

 

image

 

 

The AWS Command Line Interface

 

Before using the CLI for the first time it I had to configured it, this required me to enter the AWS Access Key Id, the AWS Secret Access Key, the default region name and default output format. Then I listed the available Buckets using the following command:

 

aws s3 ls

 

Which outputted:

 

2020-04-27 03:30:38 smartcage

 

To list the content of the bucket I entered:

 

aws s3 ls s3://smartcage

 

Which  outputted:

 

2020-04-27 03:40:39       2571 Calibrate.py

2020-04-27 03:40:39        492 CalibrateAll.py

2020-04-27 03:40:39        477 CalibrateSingle.py

2020-04-27 03:40:39        334 ClearCalibration.py

2020-04-27 03:40:39       1479 Dmm.py

2020-04-27 03:40:39       1717 Measure.py

2020-04-27 03:40:39        998 MeasureAll.py

2020-04-27 03:40:39       1310 MeasureSingle.py

2020-04-27 03:40:39       3626 PlotAccuracy.py

2020-04-27 03:40:39       2074 Psu.py

 

 

The Python SDK

 

The SDK interface is very similar to the CLI. The Python SDK library is called Boto 3, and can be installed with the PIP tool. To list all Buckets and then the contents of the "smartcage" Bucket in the same format as the previously shown CLI format, the following code was used:

 

import boto3

 

s3 = boto3.client('s3')

 

response = s3.list_buckets()

 

for bucket in response['Buckets']:

    creationDate = bucket['CreationDate'].astimezone().strftime("%Y-%m-%d %H:%M:%S")

    name  = bucket['Name']

    print('{:s} {:s}'.format(creationDate, name))

 

print('')

 

response = s3.list_objects_v2(Bucket = 'smartcage')

 

for content in response['Contents']:

    lastModified = content['LastModified'].astimezone().strftime("%Y-%m-%d %H:%M:%S")

    size = content['Size']

    key = content['Key']

    print('{:s} {:10d} {:s}'.format(lastModified, size, key))

 

Which outputted:

 

2020-04-27 03:30:38 smartcage

 

2020-04-27 03:40:39       2571 Calibrate.py

2020-04-27 03:40:39        492 CalibrateAll.py

2020-04-27 03:40:39        477 CalibrateSingle.py

2020-04-27 03:40:39        334 ClearCalibration.py

2020-04-27 03:40:39       1479 Dmm.py

2020-04-27 03:40:39       1717 Measure.py

2020-04-27 03:40:39        998 MeasureAll.py

2020-04-27 03:40:39       1310 MeasureSingle.py

2020-04-27 03:40:39       3626 PlotAccuracy.py

2020-04-27 03:40:39       2074 Psu.py

 

The Python SDK used the same configuration than the CLI, so it was not set through code.

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube