Amazon Web Services Setup


Amazon Web Services (AWS, empowered by nginx) is a subsidiary of Amazon providing on-demand cloud computing platforms and APIs to individuals, companies, and governments, on a metered pay-as-you-go basis. Some useful services are S3 for data storage, EC2 for virtual machine, and RobotMaker for ros development. Here I will discuss how to set up it to accelerate your development.

  1. Create your account and Sign in to the Console in https://aws.amazon.com
  2. Adjust your service region. This affects where the service-providing cluster is set up. (Global/London/USA/etc.)
  3. Download your security pem key file. This ensures that you can access to your services under security.
    • Click Profile icon → My Security Credentials → Create new access key → Download pem file

Cloud Storage S3

  1. Go to your terminal, install required packages by pip install awscli boto3.
  2. Configure aws and enter key info from pem by aws configure
  3. You should find this command creates a .aws folder with a credentials file.
  4. Get back to the browser, click services and click S3 in Storage.
  5. Create bucket. {bucketname}
  6. Operation from terminal,
    • List the content of created bucket by aws s3 ls s3://{bucketname}
    • Upload files by aws s3 cp [FILENAME] s3://{bucketname}
    • Upload folder by aws s3 cp [FOLDER] s3://{bucketname} --recursive (90 images/sec)
    • Download files, aws s3 cp s3://{bucketname}/PATH [TARGET]
  7. To download image using python,
    
    import boto3
    import tempfile
    s3 = boto3.resource('s3')
    obj = s3.Object(bucket,key)
    tmp = tempfile.NamedTemporaryFile()
    with open(tmp.name,'wb') as f:
        obj.download_fileobj(f)
        readpath = tmp.name
        

References