"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > How to use botoith Google Colab and AWS integration

How to use botoith Google Colab and AWS integration

Published on 2024-11-05
Browse:391

How to use botoith Google Colab and AWS integration

Have you ever thought that you want to confirm the operation of codes one by one when implementation of AWS Lambda?

You probably think it is pain to implement on AWS console because you have to run Lambda function and it costs each time.

Therefore, I will show you the solution of your worry.
It is implementation with Google Colab and AWS integration.

The steps is following:

Step 1: Store AWS configuration files on Google Drive

Operating system Default location and name of files
Linux and macOS ~/.aws/config

~/.aws/credentials
Windows %USERPROFILE%.aws\config

%USERPROFILE%.aws\credentials

Resource
Location of the shared config and credentials files - AWS SDKs and Tools

Step 2: Mount Google Drive

from google.colab import drive
drive.mount('/content/drive')

Step 3: AWS Authetication configuration

import os

config_file = "/content/drive/MyDrive/path/to/file/config"
os.environ['AWS_CONFIG_FILE'] = config_file

credentials_file = "/content/drive/MyDrive/path/to/file/credentials"
os.environ['AWS_SHARED_CREDENTIALS_FILE'] = credentials_file

Step 4: Install boto3

!pip install boto3

Caution
You should configure appropriate IAM Role to >operate AWS resources.
Don't forget it!

In this way, you can implement Lambda function simply and flexibly on Google Colab.

Please try it!

Release Statement This article is reproduced at: https://dev.to/kyotanakada/how-to-use-boto3-with-google-colab-and-aws-integration-4c2m?1 If there is any infringement, please contact [email protected] to delete it
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3