80
AWS SDK for Android & iOS [AWS Meister - Reloaded] 웨비나 시리즈 발표자료 작성: 安川 健太 솔루션스 아키텍트 玉川 憲 솔루션스 아키텍트 번역: 정윤진 솔루션스 아키텍트 자료의 내용은 웨비나가 진행된 20121015일에 맞춰져 있어 현재의 내용과는 다를 있습니다. 내용에 대한 문의사항이 있으신 경우 info- [email protected]으로 연락 주시기 바랍니다.

20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

Embed Size (px)

Citation preview

Page 1: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

AWS SDK for Android & iOS

[AWS Meister - Reloaded] 웨비나 시리즈 발표자료 작성: 安川 健太 솔루션스 아키텍트 및 玉川 憲 솔루션스 아키텍트

번역: 정윤진 솔루션스 아키텍트

이 자료의 내용은 웨비나가 진행된 2012년 10월 15일에 맞춰져 있어 현재의 내용과는 다를 수 있습니다. 내용에 대한 문의사항이 있으신 경우 [email protected]으로 연락 주시기 바랍니다.

Page 2: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

Agenda

AWS SDK 개요

모바일 앱에서 AWS 활용법

AWS SDK for Android

AWS SDK for iOS

모바일 앱에서 AWS Credentials 의 취급

정리

Page 3: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

AWS SDK 개요

Page 4: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

AWS 관련 작업은 보통

AWS Management Console

AWS 명령줄 도구

Page 5: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

이러한 도구의 뒷편에서는…

각 서비스의 모든 작업은 API가 정의되어 있음

AWS는…

• GUI 및 CLI 도구를 제공하는 동시에

• 프로그래밍, 자동화, 단순화된 사용자 도구를 함께 제공 • 매번 손으로 직접 수행하지 않고 어플리케이션을 통해 자동화 가능하며, 이는 SDK 를 사용하여 가장 쉽게 사용 할 수 있음

AWS 가 제공하는 가장 뛰어난 도구

Page 6: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

AWS SDK

AWS가 제공하는 서비스를 프로그램에서 제어 할 수 있는 SDK • 다양한 언어로 제공됨

• AWS SDK for Java

• AWS SDK for .Net

• AWS SDK for Ruby

• AWS SDK for PHP

• AWS SDK for Python (boto)

• AWS SDK for Android

• AWS SDK for iOS

• AWS 사용자에 의해 구현된(ActionScript)

• 모든 AWS와의 통신은 기본적으로 HTTPS

Page 7: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

다이어그램

EC2 인스턴스

실행 및 중지

Put,Get

DB 실행

및 백업

성능 확인

REST

SOAP AWS SDK

인증 토큰

Page 8: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

인증 정보

AWS 인증키(Access Key, Secrect Key) • AWS 로그인 후, [계정]>[보안인증서]화면에서 검색

• IAM 사용자는 ManagementConsole의 IAM에서 검색

Page 9: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

모바일 앱에서는 어떻게 사용 할 수 있을까?

Page 10: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

모바일 앱에서 AWS 활용법

Page 11: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

모바일 앱에서의 AWS 활용법

AWS 관리 콘솔 응용 프로그램 어디서나 인프라 관리 및 모니터링 가능

사용자간 정보 공유 서비스를 기획중이라면 • 사진, 동영상등의 컨텐츠를 S3에 업로드 하여 정보를 공유

• 응용 프로그램에 필요한 공유 데이터를 DynamoDB에 저장/참조

사용자 수가 폭발적으로 증가하더라도 걱정 없이 처리 가능

메세징 구현이 필요하다면 • SNS 와 SQS를 조합하여 push notification, 메세지 발송

• SES를 사용하여 Email 을 전송

자체 서버 별도 구축 없이 대량의 메세지 처리가 가능

AWS 를 모바일 서비스의 Back-end 로 사용가능

Page 12: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

모바일 SDK를 사용하여 AWS를 Back-end로

AWS Android/iOS SDK 는… • AWS의 각종 서비스를 자유롭게 사용 가능

• AWS 가 직접 관리해 주는 서비스로 백엔드를 구성 가능

• 다양한 서비스를 조합하여 원하는 로직을 서버 없이 구현

Page 13: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

AWS를 Back-end 로 사용한 예

DynamoDB, S3를 사용하여 데이터를 공유

1. 파일을 S3에 업로드, DB에 URL

을 저장

2. DB 쿼리를 통해

URL 획득

3. DB를 통해 획득한 URL로 Contents

요청

DynamoDB

S3

Page 14: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

AWS를 Back-end로 사용 예 (2)

SNS와 SQS를 사용하여 Pub/Sub

+

1. Publish

2. Notify

SNS topic SQS queue

SNS: Simple Notification Service

SQS: Simple Queue Service

Page 15: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

서버 side 코딩 없이 어플리케이션 제작

awschat: AWS 서비스만으로 만드는 채팅 어플 • 서버측 코딩 없이 게시판 / 채팅 서비스를 제공

DynamoDB

・메세지 저장

・채팅 그룹과 메세지 매핑

Simple Notification Service (SNS)

・신규 메세지 알림

Simple Queue Service (SQS)

・SNS 연동

Simple Storage Service (S3)

・사진, 영상등을 저장

Page 16: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

awschat의 동작: 채팅 그룹에 사용자 등록 Subscribe

지난 메세지는 DynamoDB 에서 검색

SQS에 큐를 만들고 SNS에 Subscribe

1. SQS 큐를 작성

채팅 그룹의 SNS

topic

클라이언트 A

2. SNS topic에 Subscribe

클라이언트 B

3. 신규 메세지 저장

4. SNS topic에 Publish

5. SQS를 통해 통지

0. 메세지 목록

수신

Page 17: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

awschat 의 동작: 채팅 그룹에 파일 업로드

S3에 파일을 업로드

SNS 알림 채팅 그룹의 SNS

topic

클라이언트 A 클라이언트 B

1. 파일 업로드

3. SNS topic Publish

4. SQS 를 통해 통보 2. 메세지 저장

5. 파일 다운로드

Page 18: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

비동기 일괄 처리

비동기 일괄 처리 (batch) 요청을 직접 등록 • 일반 Web app 등

• Android/iOS SDK를 사용하는 경우

Client

Web Frontend Workers

Job queue

Workers

Job queue

Page 19: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

로그와 이벤트 정보의 집계 및 처리

로그와 웹 이벤트 정보를 직접 등록 • 일반 Web app의 경우

• Android/iOS SDK를 사용한 경우

Client

Web Frontend 로그 이벤트 집계

로그 이벤트 집계

Page 20: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

SDK에서 AWS를 Back-end 로 사용하면

모바일 앱 개발에 다양한 장점: • 백엔드의 개발 비용을 최소화

• 백엔드의 운용 비용을 최소화

• 확장성을 걱정할 필요 없음

• 엄청난 수준의 비용 절감 (*)

필요에 따라 EC2 를 도입 결정 할 수 있음 • 향후 필요한 시점에 로직을 넣은 EC2 를 서비스에 적용

* EC2 에서 동일용도로 서버를 사용하는 것에 비해

Page 21: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

AWS SDK FOR ANDROID

Page 22: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

AWS SDK for Android

Amazon이 제공하는 AWS 기반 Android 전용 SDK

공식 홈페이지:http://aws.amazon.com/ko/sdk-for-android/

환경:Android 2.1 (API level 7)이상

• 다음의 기능은 Android 2.2 (API level 8) 이상에서 지원 • DynamoDB over SSL

• DynamoDB Mapper

사용 방법 • 공식 페이지에서 다운로드

• Git 저장소에서

Maven을 사용하는 경우:

공식 Maven 레포지트리에서 Local 저장소에 설치하여 사용이 가능(단, 공식적으로 지원하지는 않음)

Page 23: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

사용 가능한 서비스 (2012년 기준)

EC2 S3

DynamoDB SimpleDB

SNS SQS

SES ELB

CloudWatch Autoscaling

※iOS SDK 와 동일한 지원 범위를 가짐

Page 24: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

사용 가능한 서비스 (2014년 기준)

EC2 S3 Cognito

DynamoDB SimpleDB Mobile Analytics

SNS SQS

SES ELB

CloudWatch Autoscaling

※iOS SDK 와 동일한 지원 범위를 가짐

Page 25: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

SDK에 포함되는 내용

AWS Android 라이브러리 • 각종 서비스를 위한 API 를 제공하는 Java 라이브러리 • Android 앱 프로젝트에서 참조 • 결국 APK 에 내포

코드 샘플 • 각종 서비스를 사용한 로직 • SNS와 SQS를 사용한 메세징 • S3 업로더 • SimpleDB 를 사용한 스코어링 • SES 피드백 • DynamoDB 를 사용한 사용자 환경

문서

Page 26: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

초기 설정

프로젝트 종속성에 Android SDK를 추가 • Eclipse와 Android SDK를 사용하는 경우:

필요한 라이브러리를 프로젝트의 libs 에 복사

참고: 다른 위치를 사용할 경우 최종 APK 클래스 파일이 포함되도록 할것

Page 27: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

Jar 파일 사용에 대한 tips

개발시 디버깅 심볼이 있는 라이브러리를 사용

배포시 필요한 서비스만을 포함

aws-android-sdk-<version>.jar

aws-android-sdk-<version>-ddb-mapper.jar

aws-android-sdk-<version>-debug.jar

aws-android-sdk-<version>-ddb-mapper-debug.jar

전부 포함 aws-android-sdk-<version>-core.jar

aws-android-sdk-<version>-ddb.jar

aws-android-sdk-<version>-s3.jar

aws-android-sdk-<version>-sns.jar

aws-android-sdk-<version>-sqs.jar

필요한 서비스만 포함

DynamoDBMapper를

사용하는 경우 필요

또는 proguard를 사용하여 필요한 패키지만을 포함

Page 28: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

샘플의 사용

AWSAndroidDemo 의 시작 1. samples/S3_SimpleDB_SNS_SQS_Demo 를

준비

2. AWS 의 인증 정보를 설정

• AwsCredentials.properties 편집

3. 응용 프로그램을 시작

ACCESS_KEY_ID=CHANGE ME

SECRET_KEY=CHANGE ME

SDK라이브러리에는 의존성이 이미 포함되어 있으므로 별도의 설정 필요 없음

위와 같은 형태로 인증 정보를 응용 프로그램에 제공하는 것은 데모를 위해서만.

보안 및 인증정보 관리에 대해서는 이후에 설명 (또는 Cognito 를 사용)

Page 29: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

코드 예제

void uploadToS3 (String bucketName, String objectName, File file){ AmazonCredentials credentials = new BasicAmazonCredentials(ACCESS_KEY, SECRET_KEY); AmazonS3Client s3 = new AmazonS3Client(credentials); PutObjectRequest req = new PutObjectRequest(bucketName, objectName, file)); PutObjectResponse resp = s3.putObject(req); }

기본적인 흐름 (iOS 역시 동일 ) • 이용하는 서비스 클라이언트 객체 생성

• 서비스 요청 객체를 생성

• 클라이언트 객체를 통해 요청

• 응답을 수신

S3에 파일을 업로드 하는 코드 예제

Page 30: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

코드 예제:S3 파일 업로드 (비동기) S3UploadTask uploadTask = new S3UploadTask(); uploadTask.execute(new PutObjectRequest(bucketName, objectName, tempFile)); private class S3UploadTask extends AsyncTask<PutObjectRequest, Long, Long> implements ProgressListener { protected Long totalSent; // AsyncTask#doInBackground() protected Long doInBackground (PutObjectRequest... reqs) { totalSent = 0L; reqs[0].setProgressListener(this); S3.getInstance().putObject(reqs[0]); return totalSent; } // ProgressListener#progressChanged() public void progressChanged (ProgressEvent progressEvent) { totalSent += progressEvent.getBytesTransfered(); publishProgress(totalSent); } }

백그라운드에서

실행

진행율

업데이트

Page 31: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

코드 예제:DynamoDB에 Query

QueryResult doQuery (String hashKey, String max) {

AttributeValue hashKey = new AttributeValue().withS(hashKey);

Condition lessThanMax = new Condition()

.withComparisonOperator(ComparisonOperator.LT)

.withAttributeValueList(new AttributeValue().withN(max));

QueryResult result = dynamoClient.query(new QueryRequest()

.withTableName(TABLE_NAME)

.withLimit(NUMBER_OF_ITEMS_TO_GET_AT_ONCE)

.withHashKeyValue(hashKey)

.withRangeKeyCondition(lessThanMax)

);

return result; }

Hash key 및 range key 의 max 를 사용하여 특정 테이블에 쿼리 하는 코드

조건을

지정

쿼리를

수행

Hash

key를 지정

Page 32: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

코드 예제:SNS의 Publish

void publishMessage (String topicArn, String message){ PublishRequest pubReq = new PublishRequest(); pubReq.setMessage(message); pubReq.setTopicArn(topicArn); snsClient.publish(pubReq); }

void publishMessage (String topicArn, String message){ snsClient.publish(new PublishRequest() .withTopicArn(topicArn) .withMessage(message)); }

물론 Fluent Setter 에도 적용

Page 33: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

코드 예제:DynamoDBMapper 에서 DynamoDB 에 객체를 저장 및 로딩

@DynamoDBTable(tableName = “meisters_items”)

public class MeistersItem {

private String id;

private long value;

@DynamoDBHashKey(attributeName = “id”)

public String getId() {

return id;

}

@DynamoDBHashKey(attributeName = “id”)

public void setId(String id) {

this.id = id;

}

@DynamoDBAttribute(attributeName = “value”)

public long getValue() {

return time;

}

@DynamoDBAttribute(attributeName = “value”)

public void setValue(long time) {

this.time = time;

} }

MeisterItem item = new MeisterItem();

item.setId(“Expensive item”);

item = dbMapper.load(MeisterItem.class, item);

AmazonDynamoDBClient dynamoClient =

new AmazonDynamoDBClient(getCredentials());

AmazonDynamoDBMapper dbMapper =

new DynamoDBMapper(getDynamoClient());

MeisterItem item = new MeisterItem();

item.setId(“Expensive item”);

item.setValue(10000);

dbMapper.save(item);

DynamoDBMapper 초기화

POJO 저장

POJO 로드

POJO 를 정의

Page 34: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

Android SDK Tips

UI 스레드에서 AWS의 API 호출은 가급적이면 자제 • 적절하게 AsyncTask 또는 별도의 Thread를 사용

각 서비스 클라이언트 인스턴스를 재사용 • 서비스 클라이언트 구현은 Thread Safe

• Singleton함으로서 무거운 객체 생성을 최소화

• 예:AmazonClientManager 샘플

public class AmazonClientManager {

private AmazonS3Client s3Client = null;

public AmazonS3Client s3() {

if (s3Client == null) s3Client = new AmazonS3Client( credentials );

return s3Client;

}

}

Page 35: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

AWS SDK FOR IOS

Page 36: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

AWS SDK for iOS

Amazon 제공 AWS 개발 iOS SDK

공식 페이지:http://aws.amazon.com/ko/sdkforios/

요구사항:iOS 4.3 이상

개발 환경:Xcode v4 이상

사용 방법 • 공식 홈페이지에서 다운로드

• Git 저장소를 이용

Page 37: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

사용 가능한 서비스 (2012년 기준)

EC2 S3

DynamoDB SimpleDB

SNS SQS

SES ELB

CloudWatch Autoscaling

※Android SDK 와 동일한 지원 범위를 가짐

Page 38: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

사용 가능한 서비스 (2014년 기준)

EC2 S3 Cognito

DynamoDB SimpleDB Mobile Analytics

SNS SQS

SES ELB

CloudWatch Autoscaling

※Android SDK 와 동일한 지원 범위를 가짐

Page 39: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

SDK에 포함되는 내용 AWS iOS 라이브러리 • 각종 서비스를 위한 API 를 제공하는 Objective-C 라이브러리

• iOS 응용 프로그램 프로젝트의 프레임워크 중 하나로 참조

코드 샘플 • 각종 서비스 작업

• SNS 와 SQS 를 사용한 메세징

• S3 업로더

• SimpleDB

• SES

• DynamoDB 사용자 환경 설정

• DynamoDB 를 사용한 CoreData 프레임웍의 백엔드 구현

문서

Page 40: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

초기 설정 ~Framework 추가~

프로젝트에서 SDK를 추가 1. Xcode 에서 프로젝트 오픈

2. Frameworks Group을 Ctrl를 누른채로 클릭

3. AWSiOSSDK.framework 추가

• AWSPersistence.framework 는 임의 (DynamoDB + CoreData 를 사용한 Persistence를 적용하는 경우)

4. 소스코드에서 필요한 헤더를 로드

• 예

#import <AWSiOSSDK/S3/AmazonS3Client.h>

#import <AWSiOSSDK/SimpleDB/AmazonSimpleDBClient.h>

#import <AWSiOSSDK/SQS/AmazonSQSClient.h>

#import <AWSiOSSDK/SNS/AmazonSNSClient.h>

Page 41: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

초기설정 ~문서 설치~

문서 세트를 Xcode에 설치 • SDK의 디렉토리에서 docset 파일을 복사

• 이 파일을 – Documentation/com.amazon.aws.ios.docset

• 아래의 위치에 – $HOME/Library/Developer/Shared/Documentaion/DocSets

• Xcode를 다시 시작

$ mkdir –p $HOME/Library/Developer/Shared/Documentaion/DocSets

$ cp Documentation/com.amazon.aws.ios.docset\

$HOME/Library/Developer/Shared/Documentaion/DocSets

Page 42: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

샘플

AWSiOSDemo 시작 1. samples/S3_SimpleDB_SNS_SQS_Demo/ A

WSiOSDemo.xcodeproj 를 Xcode 에서 오픈

2. AWS의 인증 정보를 설정

• AWSiOSDemo/Classes/Constants.h편집

3. 응용 프로그램을 시작

ACCESS_KEY_ID=CHANGE ME

SECRET_KEY=CHANGE ME

위와 같은 형태로 인증 정보를 응용 프로그램에 제공하는 것은 데모를 위해서만.

보안 및 인증정보 관리에 대해서는 이후에 설명 (또는 Cognito 를 사용)

Page 43: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

코드 예제

- void uploadToS3: (NSString*) bucketName keyName: (NSString *) keyName fileName: (NSString *) fileName { S3PutObjectRequest *putObjectRequest =

[[[S3PutObjectRequest alloc] initWithKey:keyName inBucket:bucketName] autorelease];

putObjectRequest.filename = fileName;

[[AmazonClientManager s3] putObject:putObjectRequest]; }

기본 흐름 (Android 도 동일 ) • 이용하는 서비스 클라이언트의 객체 생성 • 서비스 요청 객체를 생성 • 클라이언트 객체를 통해 요청 • 응답을 수신

S3에 파일을 업로드 하는 코드 예제

Page 44: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

코드 예제 :S3파일 업로드(비동기) 1/2

#import <Foundation/Foundation.h>

#import <AWSiOSSDK/AmazonServiceRequest.h>

@interface AsyncImageUploader:NSOperation<AmazonServiceRequestDelegate>

{

- (void) start {

….

// Puts the file as an object in the bucket.

S3PutObjectRequest *putObjectRequest =

[[[S3PutObjectRequest alloc] initWithKey:keyName inBucket:bucketName] autorelease];

putObjectRequest.filename = filename;

putObjectRequest.delegate = self;

[[AmazonClientManager s3] putObject:putObjectRequest];

}

NSOperation의 서브 클래스로 S3 Uploader 를 구현

Delegate 도중 상태를 받을 수 있도록

등록

Page 45: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

코드 예제 :S3파일 업로드(비동기) 2/2

-(void) request:(AmazonServiceRequest *)request

didCompleteWithResponse:(AmazonServiceResponse *)response

{

[self performSelectorOnMainThread:@selector(hideProgressView)

withObject:nil waitUntilDone:NO];

[self finish];

}

-(void) request:(AmazonServiceRequest *)request

didSendData:(NSInteger)bytesWritten

totalBytesWritten:(NSInteger) totalBytesWritten

totalBytesExpectedToWrite:(NSInteger) totalBytesExpectedToWrite

{

[self performSelectorOnMainThread:@selector(updateProgressView:)

withObject:

[NSNumber numberWithFloat:

(float)totalBytesWritten / totalBytesExpectedToWrite] waitUntilDone:NO];

}

Delegate 패턴 도중 경과와 결과를 받아

완료시

처리

진행률

업데이트

처리

Page 46: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

코드 샘플:DynamoDB 에 Query

-(DynamoDynamoDBQueryResponse *) doQuery: (NSString*) hashKey

max: (NSString *) max {

DynamoDBQueryRequest *req = [[DynamoDBQueryRequest alloc] autorelease];

req.tableName = TABLE_NAME;

req.limit = [[NSNumber alloc] initWithInt: NUMBER_OF_ITEMS_TO_GET_AT_ONCE];

req.hashKeyValue = [[DynamoDBAttributeValue alloc] initWithS: hashKey] autorelease];

DynamoDBCondition *lessThanMax = [[DynamoDBCondition alloc] autorelease];

[req.rangeKeyCondition setComparisonOperator: @“LT"];

[req.rangeKeyCondition addAttributeValueList:

[[[DynamoDBAttributeValue alloc] initWithN: max] autorelease]];

req.rangeKeyCondition = lessThanMax;

DynamoDBQueryResponse *resp = [[AmazonClientManager dynamodb] query: req];

return resp;

}

조건을

지정

쿼리

Hash

key

지정

Page 47: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

코드 예제:SNS Publish

- void publishMessage: (NSString*) topicArn

message : (NSString *) message { SNSPublishRequest req = [[[SNSPublishRequest alloc] initWithTopicArn:topicArn

andMessage: message] autorelease]; [[AmazonClientManager sns] publish: req]; }

Page 48: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

코드 예제:CoreData 프레임워크 DynamoDB에 객체를 저장 및 로드 (1/2)

NSDictionary *hashKeys = [NSDictionary

dictionaryWithObjectsAndKeys:

@"locationId", @"Location",

@"checkinId", @"Checkin", nil];

AWSPersistent.framework추가

CoreData프레임워크에서 데이터 모델 정의

NSPersistentStoreCoordinator 설정 • DynamoDB 테이블에 맞도록

NSDictionary *tableMapper = [NSDictionary

dictionaryWithObjectsAndKeys:

@"AWS-Locations", @"Location",

@"AWS-Checkins", @"Checkin", nil];

Hash key 지정

테이블 매핑 지정 (기본적으로는 Entity name)

데이터 모델 정의

프레임웍 추가

Page 49: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

코드 예제:CoreData 프레임워크 DynamoDB에 객체를 저장 및 로드 (2/2)

신규 객체 생성 및 저장

저장된 객체를 로드

Checkin *checkin = (Checkin *)[NSEntityDescription insertNewObjectForEntityForName:@"Checkin"

inManagedObjectContext:managedObjectContext];

checkin.checkinId = [Utilities getUUID];

checkin.checkinTime = [NSDate date];

checkin.comment = @"First Checkin";

NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];

NSEntityDescription *entity = [NSEntityDescription entityForName:@"Location"

inManagedObjectContext:managedObjectContext];

[request setEntity:entity];

NSArray *fetchedResults = [managedObjectContext executeFetchRequest:request error:&error];

Page 50: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

AWS Persistent 프레임워크 사용 주의점

AWS Persistent 프레임워크의 제한 • Hash key 에 해당되는 속성

• String 또는 Numeric만

• NSPredicates 의 주요 제한 사항 • 현재 Hash key 만 지원

• Hash key 를 한번에 사용 가능한 값은 하나

• Predicate를 사용하지 않으면 Scan 작업을 위한 오버헤드가 커짐

현재로서는 여러 개체를 한번에 검색하는 케이스에 적합

• Hash key에 대응하는 속성에 사용 할 수 있는것은 String 또는 Numeric 만

• 기타 자세한 내용은 문서 참조

Region 선택은 1.4.3 이상에서 지원 • 기본은 US-east

Page 51: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

iOS SDK Tips

UI 스레드에서 AWS의 API 호출은 지양 • 적절히 NSOperation과 GCD 등을 사용

각 서비스 클라이언트 인스턴스를 재사용 • 서비스 클라이언트 구현은 Thread Safe

• 예 :샘플 코드의 AmazonClientManager

#import "AmazonClientManager.h"

static AmazonS3Client *s3 = nil;

@implementation AmazonClientManager

+(AmazonS3Client *)s3

{

if(s3 == nil) s3 = [[AmazonS3Client alloc] initWithCredentials:credentials];

return s3;

}

Page 52: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

AWS CREDENTIALS의 취급

Page 53: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

누구의 AWS 계정을 사용?

AWS 콘솔 응용 프로그램을 만드는 경우 • 최종 사용자는 AWS 사용자

AWS의 액세스키와 비밀키를 넣어주면 OK

AWS의 각종 서비스를 사용한 응용 프로그램을 만드는 경우 • AWS의 각종 서비스는 어디까지나 백엔드

• 최종 사용자는 반드시 AWS 사용자가 아니어야 함

응용 프로그램의 개발자 계정 인증/승인을 받아야 함

* 2014년 현재는 Cognito 서비스를 사용하거나 STS 를 사용 가능

Page 54: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

개발자 계정의 사용으로….

앱 개발자 계정의 엑세스키를 어플리케이션에 넣는 경우 • 키가 광범위하게 노출됨

• 키의 무단 사용을 막기위해 비활성화 하면

모든 사용자 서비스가 중지됨

엑세스 키의 정기적 업데이트로 해결하는 방안의 경우 • 앱의 버전 업데이트마다 키를 업데이트 하는 것은 매우 비현실적

• 업데이트 되기 전의 클라이언트는 서비스 불가

Page 55: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

보안 AWS 엑세스를 제공하려면

응용 프로그램에 인증 정보를 포함해서는 안됨

최종 사용자/단말마다 다른 Credentials 를 제공해야 함 • 사용자별 최소한의 권한을 부여

• 부정 사용 적발시 잘못된 사용자만을 정지

Credentials 기한이 만료되면 비활성화 • 허가받지 않은 사용자 권한도 만료가 가능 해야

구현이 가능!!

Page 56: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

Security Token Service

AWS에 대한 임시 인증 정보 생성 • 만료 시간이 정해진 인증 정보 (인증 티켓) 발행

• Identity and Access Management (IAM)적용 가능

사용자에게 다음의 3개 키를 발급 가능 엑세스 ID

비밀 키

세션 토큰

작성한 인증 정보의 유효 기간 설정 가능 기본 12시간 최소 1시간 최대36시간

연장/단축이 불가능

Page 57: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

인증 토큰을 사용한 서비스의 흐름

1 STSから

Token Vending Machine (TVM) 을 도입 • 사용자/단말기 인증과 토큰 발급

• 각 응용 프로그램 인증 및 AWS 인증 메커니즘 연동 서비스

1. Security Token Service에서 인증 토큰을 가져옴

2. 클라이언트에 인증 토큰을

제공

3. 클라이언트는 인증 토큰을

이용하여 AWS에 접근

1

2

3

응용 프로그램에

따라 구현 가능

Page 58: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

STS + 고객 사용자 인증을 사용한 서비스의 흐름

Page 59: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

Token Vending Machine 구현

Amazon 에서 공개하고 있는 TVM의 구현 • AnonymousTVM

• 사용자 인증을 필요로 하지 않고, 임시 인증 토큰의 기능만을 이용하고자 하는 경우

• 예:아무나 글을 남길 수 있는 게시판 등의 구현

• IdentityTVM

• 사용자 인증을 하고 인증된 사용자에게만 토큰을 발급하는 케이스

• 예:사용자 인증이 필요한 소셜 및 앱 게임 등

직접 구현하거나, Amazon 이 제공하는 샘플 코드를 사용하여 확장 가능

Page 60: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

Anonymous TVM

디바이스별 ID 와 일치하는 개인키를 TVM에 등록

비밀키를 사용하여 인증 토큰을 암호화 하여 제공

디바이스 ID와 비밀키를 등록

비밀키를 사용하여

토큰을 암호화

Page 61: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

Identity TVM

Out-of-band로 등록

등록된 사용자 정보로 로그인 처리

TVM용 비밀키 공유

비밀키를 사용하여 인증 토큰을 암호화 해서 전달

Anonymous와 동일하게

사용자의 인증 정보

암호화

Facebook, Twitter,

LDAP 및 AD등 인증 시스템으로 대체 가능

Page 62: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

TVM 도입시 흐름

인증 토큰에 대한 사용자 권한을 설정 • Identity and Access Management (IAM) 에서 사용자를 생성

• 응용 프로그램 정책에 맞게 권한을 할당

TVM 구현 및 실행 • 샘플은 WAR 파일을 배포하기만 하면 즉시 실행 가능

• AnonymousTVM

• IdentityTVM

ElasticBeanstalk를 사용하면 더욱 쉽게!

TVM의 각종 설정 • Security Token Service에 엑세스 하기 위한 엑세스 키 설정

• SSL 설정 (권장)

Page 63: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

인증 토큰에 대한 사용자 권한을 설정 (1/2)

IAM에서 TVM의 새로운 사용자 생성(예:TVMUser)

인증 정보(엑세스키 및 비밀키)를 저장

향후 TVM 어플리케이션에 설정해야 하므로 잃어버리지 않도록 주의

Page 64: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

인증 토큰에 대한 사용자 권한을 설정 (2/2)

정책을 생성, 설정 및 할당

사용자 정의 정책의 예 (TVM샘플에 포함됨) { "Statement": [

{ "Effect": "Allow", "Action": "sts:GetFederationToken", "Resource": "*" },

{ "Effect": "Allow", "Action": "iam:GetUser", "Resource": "*" },

{ "Effect": "Allow", "Action": "sdb:*", "Resource": "*" },

{ "Effect":"Allow", "Action":"dynamodb:*", "Resource":"*" },

{ "Effect": "Allow", "Action": "sqs:*", "Resource": "*" },

{ "Effect": "Allow", "Action": "s3:*", "Resource": "*" },

{"Effect": "Allow", "Action": "sns:*", "Resource": "*" }

]

} 응용 프로그램에 적용할때는 필요한 권한만 부여하도록 주의

Page 65: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

TVM 샘플의 구동 (1/2)

ElasticBeanstalk 에서 응용 프로그램을 생성

Page 66: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

TVM 샘플의 구동 (2/2)

Page 67: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

TVM이 배포 된 것을 확인

TVM을 적용한 서비스에 HTTP 로 접근

아직 TVM이 Security Token

Service에 접근하기 위한 인증 정보를 가지고 있지 않음

Page 68: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

TVM 설정

TVMUser 엑세스키를 입력

TVMUser 비밀 키를 입력

응용 프로그램 이름을 입력

(Identity TVM의 경우)

exampleApp

Page 69: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

TVM의 배포가 완료 된 것을 확인

TVM을 적용한 서비스에 HTTP 로 접근

실 서비스에서는 SSL 을 필수 적용 할 것. : 디바이스 /

개인키 / 암호가 유출될 우려 종식

설정에 대한 경고 메세지가

사라지고 Security Token

Service 에 접근 가능함을

확인

Page 70: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

인증 토큰을 사용한 서비스의 흐름

1 STSから

Token Vending Machine (TVM) 을 도입 • 사용자/단말기 인증과 토큰 발급

• 각 응용 프로그램 인증 및 AWS 인증 메커니즘 연동 서비스

1. Security Token Service에서 인증 토큰을 가져옴

2. 클라이언트에 인증 토큰을

제공

3. 클라이언트는 인증 토큰을

이용하여 AWS에 접근

1

2

3

응용 프로그램에

따라 구현 가능

Page 71: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

TVM을 이용한 AnonymousTVM 동작확인

samples/S3_SimpleDB_SNS_SQS_DemoTVM

• 설정예 :

• TVM URL: http://anon-example.elasticbeanstalk.com

Android: AwsCredentials.properties 편집

tokenVendingMachineURL=anon-example.elasticbeanstalk.com

iOS: Constants.h 편집

#define TOKEN_VENDING_MACHINE_URL @“anon-example.elasticbeanstalk.com”

/gettoken?uid=<UID>&timestamp=<timestamp>&signa

ture=<Signature>

/registerdevice?uid=<UID>&key=<KEY>

http://anon-

example.elasticbeanstalk.com

<Encrypted token credentials>

Page 72: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

TVM 을 이용한 IdentityTVM 동작 확인

samples/S3_SimpleDB_SNS_SQS_DemoTVMIdentity

• 사용예:

• TVM URL: http://id-example.elasticbeanstalk.com

• 응용 프로그램 이름: exampleApp (TVM환경변수 ”PARAM1”로 설정된 이름) Android: AwsCredentials.properties 편집

tokenVendingMachineURL=id-example.elasticbeanstalk.com

appName=exampleApp

iOS: Constants.h 편집

#define TOKEN_VENDING_MACHINE_URL @“id-example.elasticbeanstalk.com”

#define APP_NAME @“exampleApp"

registeruser()

login()

Page 73: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

TVM Client 의 통합

Android / iOS 모두 TVM Client 구현 샘플 • 각 샘플의 AmazonClientManager 구현은 TVM Client를 이용

• S3_SimpleDB_SNS_SQS_DemoTVM Anonymous TVM

• S3_SimpleDB_SNS_SQS_DemoTVMIdentity IdentityTVM

추천하는 설정 단계는… 1. 기본 TVM 구현을 결정 (Anonymous or Identity)

2. 필요한 샘플 코드를 복사 • AmazonClientManager

• TVMClient

3. 필요에 따라 TVM, TVM Client, 인증 메커니즘을 정의

• Identity TVM을 정의하면 SNS와 ID 연계가 가능

Page 74: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

정리

Page 75: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

SDK를 사용하면 AWS 를 Back-end 로 사용가능 • 백엔드 개발 비용을 최소화

• 백엔드의 운영 비용을 최소화

• 확장에 대한 우려 없음

• 비용적인 면에서도 매우 우수

인증 토큰 방식을 사용함으로서 강력한 보안체계 구축 가능

AWS 는 개발자의 능력을 극대화 해 주는 인프라 • 이는 서버 뿐만이 아니라 클라이언트의 응용 프로그램에도 큰 도

• HAPPY CODING!!

정리

Page 76: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

참고 자료

Amazon에서 제공하는 Kindle Fire용 API 도 존재

In-App Purchasing API 앱에서의 결재를 1-click 방식을 사용하여 구현하는 API Get started with In-App Purchasing API

Amazon GameCircle API 게임에 필요한 리더 보드, Whispersync 등을 쉽게 구현 가능한 API Get started with the Amazon GameCircle API

Amazon Maps API 인터랙티브한 지도 API Get started with Amazon Maps API

Page 77: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

추가 - 2014 July New services for Mobile

http://aws.amazon.com/ko/cognito/

Page 78: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

추가 - 2014 July New services for Mobile

http://aws.amazon.com/ko/mobileanalytics/

Page 79: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

Github AWS samples repository

https://github.com/awslabs

Page 80: 20121015 AWS Meister Reloaded - AWS SDK for Android / iOS (Korean)

© 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.

감사합니다. http://aws.amazon.com/ko/mobile

한글번역: Younjin Jeong, AWS Solutions Architect