跳到主要內容

發表文章

目前顯示的是有「amazon」標籤的文章

[AWS懶人包] 十分鐘搞懂S3

前言 AWS S3是Amazon最早提供的雲端服務之一, 發展至今也有10幾年的歷史了, 服務的範疇也越來越大, 不單純的只是像DropBox那樣, 讓人放檔案而已, 諸如版本控制, 加解密服務, 部屬靜態網站等等... 基本上在S3上, 檔案是以物件的形式存放的 每個物件都會有一組Key和Value, S3會根據Key Name 來決定物件要被存放的實體位置, 如果物件有相似的Key Name, 則會有根大的機率被放在同一個Partition mybucket/2018-08-26/photo1.png mybucket/2018-08-26/photo2.png S3容許我們存放 0 Bytes ~ 5TB 大的檔案, 但若是使用PUT請求上傳檔案的話, 最大只能接受5GB 物件的儲存類別 S3 這是最基本的儲存方式 S3-IA 這是用來存放較不常用的檔案類型, 相對的費用也會比較便宜, 但會根據request的次數來收錢 S3 One Zone IA 跟S3-IA一樣適合用來存放不常用的檔案類型, 差別是沒有備援的機制, 所以當遇上天災人禍時, 資料可能就飛了 Security 基本上剛建立的Bucket預設是都是private 但是我們可以透過 Bucket policy, ACLs 來決定存取存取權限 Bucket Policy : 屬於Bucket層級的存取機制 比如說: 我有個skilldata的bucket, 若想開放底下所有的物件, 讓外人可以存取, 可以將Bucket Policy定義如下 {      " Id " :   " Policy1538888263614 " ,      " Version " :   " 2012-10-17 " ,      " Statement " :   [           {                " Sid " : ...

[UWP] 實作Oauth 2.0登陸取得AMAZON使用者帳戶資訊

前言: 有玩過臉書的人一定有過以下經驗, 當我們想在臉書上完算命或心理測驗的小遊戲時 就會被要求先登錄臉書的在後才能使用該服務, 這就是臉書的Oauth 2.0 認證機制 透過臉書提供的API讓程式導引使用者做認證, 進一步的授權給程式去取得使用者的資料 而Amazon也有提供類似的服務 首先 到Login With Amazon 註冊應用程式 Step 1. 打開Amazon Developer Console https://developer.amazon.com/home.html Step 2. 選擇 App Service/ Login With Amazon Step 3. 註冊應用程式 註冊完後會得到 Client Id 以及 Client Secret如下 Step 4. 設定Redirect Url 選擇Web Settings, 在Allowed Return Urls填入 https://localhost UWP 的部分 以Amazon提供的API取得access token API 規則 https://www.amazon.com/ap/oa?client_id=YOUR_CLIENT_ID &scope=profile &response_type=token &redirect_uri=https://localhost 程式範例: 取得Amazon使用者資料 API 規則 https://api.amazon.com/user/profile?access_token=YOUR_ACCEES_TOKEN 程式範例: DEMO: 點擊 Login 點擊Show user data 若需要完整的程式碼也可以到以下的網址下載 完整程式碼

使用ask cli 指令快速建立alexa skill, Part II(更新language model)

前面的章節我們學到了使用ask cli來建立快速skill, 接下來要做的事就是定義我們的language model 基本上, Amazon 提供了非常好用的UI讓我們在上面建立語意模型 所以若要定義或修改模型的話 建議可以先在amazon的網頁上做好, 然後再同步回本地端 假設本機上skill的資料夾結構如下: /lambda /models     /en-US.json skill.json 我們可以在models的資料夾底下找到語意模型 en-US.json 接下來, 使用ask cli 的 get-model 將資料同步到本機 /models/en-US.json ask api get-model --skill-id skil123478 --local en-US --stage development > models/en-US.json 然後部屬 ask deploy 但如果你的模型沒有很複雜的話, 也是可以在本底端修改, 然後再上傳

How to send a MP3 sound to Alexa with SSML

Alexa Skills Kit provides Synthesis Markup Language(SSML) to enhance the Alexa speech output. It's very convenient to make Alexa say something we expect. In some case, you may want response an MP3 sound to Alexa, how could we do that? This article focuses on how to implement the <audio> tag to play an MP3 file. Converting Audio Files to an Alexa-Friendly Format. Download FFmpeg Convert your file via below command ffmpeg -i <input-file> -ac 2 -codec:a libmp3lame -b:a 48k -ar 16000 <output-file.mp3> Hosting the Audio Files for Skills You can store your files on Amazon S3, and make them public. Or using Azure Media Service. The following steps show how to host audio files on Azure Media Service  Create Media Service resource Upload the audio files           Search "Assets" on Media Service, and click upload to add your files Publish your file and save your URL Add <audio> Tag In Your Resp...

Failed to account linking with amazon

The redirect URI you provided has been whitelisted for your application. If you see above error message, it means you have to go to amazon develop console and edit your security profile for redirect URL. Step 1. Copy redirect Redirect URLs on Alexa skill configuration page Step 2. Go to the web setting of your security profile and add these Redirect URLs you just copied to "Allowed Return URLs"

what's difference between DynamoDb and DocumentClient API

  DocumentClient provides a simple way to work with items in DynamoDB For example,  If you use DocumentCline to create a new item, you won't have to specify DynamoDb API DocumentClient API var   params   =   {     TableName:   " Sample " ,     Item:   {     "Id" :   {   S:   "john@amazon .com"   }     } }; dynamodb . putItem ( params , function ( rst , err ) { console . log ( rst ); console . log ( err ) }); var   params   =   {     TableName:   ' Sample ' ,     Item:   {      "Id" :   "john@ amazon .com"     } }; docClient . put ( params , function ( rst , err ) { console . log ( rst ); console . log ( err ) });

AWS IoT Tutorial

Create & define your thing in AWS IoT console     This article is divided into two sections as below: How to configure AWS IoT How to test it     How to configure AWS IoT   First, go to Registry\Things page   Give a name for your thing.        Go to Security page and generate your certificate     If done, your will see the detail of your certificate like:   Download your certificates, active it, and then attach a policy.    If you don't have any policy, you must create one for your thing. Click Create new policy button.   Specify the policy name and action, and check the Allow option.     If done, your will see the policy information your specified.   Now you need to go to the security page, and attach your policy and thing.       If everything is ok, you will ...