본문 바로가기

WebDev/Backend

AWS boto accessKey, secretKey

AWS boto accessKey, secretKey

아마존 boto API를 쓰려니 왠 accessKey와 secretKey를 설정하라 한다. 설정하려면 일단 만들어야 한다! 해보자

크리덴셜 생성


아래의 링크를 따라가서 생성하면 된다
https://console.aws.amazon.com/iam/home?#security_credential

크리덴셜 저장


만사가 귀찮은 경우, 생성한 크리덴셜 파일은 /etc/boto.cfg에 저장하면 된다.

boto.cfg의 내용을 아래의 형식으로 작성한다:
Credentials의 value에 절대로 ’ ‘나 ” “로 값을 묶으면 안됨에 주의! 띄어쓰기도 자제할 것!

[Credentials]
aws_access_key_id=dfxd8fzdfs2
aws_secret_access_key=Judsixdt8315iSDFAS98135gxjiFJKI
[DynamoDB]
region=ap-northeast-1
validate_checksums=True


boto가 cfg파일을 읽는 우선순위는 다음과 같다:

/etc/boto.cfg - for site-wide settings that all users on this machine will use
(if profile is given) ~/.aws/credentials - for credentials shared between SDKs
(if profile is given) ~/.boto - for user-specific settings
~/.aws/credentials - for credentials shared between SDKs
~/.boto - for user-specific settings


그러나, BOTO_CONFIG 환경변수가 설정되어 있을 경우 BOTO_CONFIG 환경변수의 값이 대입된다 


따라서 파이썬 코드로도 쉽게 정의할 수 있다.

os.environ['BOTO_CONFIG'] = '/path/to/my/boto/config' 이런 식으로

'WebDev > Backend' 카테고리의 다른 글

django deploy with sqlite3  (0) 2016.01.22
Cross Domain AJAX  (0) 2016.01.21
boto dynamodb2 사용하기  (0) 2015.11.18
Spring boot properties  (0) 2015.11.05
Spring boot session cluster  (0) 2015.11.04