0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Google ColabとAWSを連携して、boto3を使う方法

Last updated at Posted at 2024-02-03

はじめに

Lambda関数を実装するなら、まずGoogle Colabでコードの挙動をひとつずつ確かめながら書いていく方が課金を抑えられるのではと気づいたので、手順をまとめました。

1.AWS設定ファイルをGoogle Driveに保存する

  • config
  • credentials

macなら
~./aws/config
~./aws/credentials

Windowsなら
%USERPROFILE%.aws\config
%USERPROFILE%.aws\credentials

2.Google Driveのマウント

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

3.AWS認証設定

import os

config_file = "/content/drive/MyDrive/[保存フォルダ]/config"
os.environ['AWS_CONFIG_FILE'] = config_file

credentials_file = "/content/drive/MyDrive/[保存フォルダ]/credentials"
os.environ['AWS_SHARED_CREDENTIALS_FILE'] = credentials_file

4.boto3のインストール

!pip install boto3

おわりに

無料利用枠があるとはいえ、舐めない方がいい。
たかが塵、されど塵。
塵も積もればかなりの課金になる。

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?