├── website-creator ├── package.json ├── web-site-manifest.json ├── index.js ├── js │ ├── aws-cognito-helper.js │ ├── phonenumber.js │ └── amazon-cognito-identity.min.js ├── website-helper.js ├── css │ └── style.css └── phoneNumber.html ├── CODE_OF_CONDUCT.md ├── README.md ├── LICENSE ├── CONTRIBUTING.md └── template.yaml /website-creator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "website-creator", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC" 11 | } 12 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Code of Conduct 2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 4 | opensource-codeofconduct@amazon.com with any additional questions or comments. 5 | -------------------------------------------------------------------------------- /website-creator/web-site-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [ 3 | "./phoneNumber.html", 4 | "./css/style.css", 5 | "./js/aws-sdk-phonenumber.js", 6 | "./js/phonenumber.js", 7 | "./js/amazon-cognito-identity.min.js", 8 | "./js/aws-cognito-helper.js", 9 | "./js/aws-cognito-sdk.min.js" 10 | ] 11 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Amazon Connect phone number API demo 3 | 4 | This demo shows how you can leverage [Amazon Connect](https://aws.amazon.com/connect/) api to search user's by different techniques. 5 | 6 | ## Usage 7 | Use `sam` to build, invoke and deploy the function. 8 | 9 | ##### SAM Build: 10 | Ensure you are in the root folder 11 | 12 | `sam build --use-container` 13 | 14 | ##### SAM Deploy: 15 | `sam deploy template.yaml --s3-bucket REPLACE_ME --stack-name REPLACE_ME --parameter-overrides ParameterKey=CFS3BucketForWebSite,ParameterValue=REPLACE_ME ParameterKey=CFSInstanceARNParam,ParameterValue=REPLACE_ME_WITH_FULL_INSTANCE_ARN --capabilities CAPABILITY_IAM` 16 | 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 11 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 12 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | 16 | -------------------------------------------------------------------------------- /website-creator/index.js: -------------------------------------------------------------------------------- 1 | const AWS = require('aws-sdk'); 2 | const https = require('https'); 3 | const url = require('url'); 4 | const WebsiteHelper = require('./website-helper.js'); 5 | 6 | exports.handler = (event, context, callback) => { 7 | console.log('Received event:', JSON.stringify(event, null, 2)); 8 | 9 | let responseStatus = 'FAILED'; 10 | let responseData = {}; 11 | 12 | if (event.RequestType === 'Delete') { 13 | sendResponse(event, callback, context.logStreamName, 'SUCCESS'); 14 | } 15 | 16 | if (event.RequestType === 'Create') { 17 | if (event.ResourceProperties.customAction === 'configureWebsite') { 18 | console.log('Starting to copy the files'); 19 | let _websiteHelper = new WebsiteHelper(); 20 | 21 | _websiteHelper.copyWebSiteAssets(event.ResourceProperties, 22 | function(err, data) { 23 | if (err) { 24 | responseData = { 25 | Error: 'Copy of website assets failed' 26 | }; 27 | console.log([responseData.Error, ':\n', err].join('')); 28 | } else { 29 | responseStatus = 'SUCCESS'; 30 | responseData = {}; 31 | } 32 | 33 | sendResponse(event, callback, context.logStreamName, responseStatus, responseData); 34 | }); 35 | 36 | } 37 | //sendResponse(event, callback, context.logStreamName, 'SUCCESS'); 38 | } 39 | 40 | 41 | }; 42 | 43 | /** 44 | * Sends a response to the pre-signed S3 URL 45 | */ 46 | 47 | let sendResponse = function(event, callback, logStreamName, responseStatus, responseData) { 48 | const responseBody = JSON.stringify({ 49 | Status: responseStatus, 50 | Reason: `See the details in CloudWatch Log Stream: ${logStreamName}`, 51 | PhysicalResourceId: logStreamName, 52 | StackId: event.StackId, 53 | RequestId: event.RequestId, 54 | LogicalResourceId: event.LogicalResourceId, 55 | Data: responseData, 56 | }); 57 | 58 | console.log('RESPONSE BODY:\n', responseBody); 59 | const parsedUrl = url.parse(event.ResponseURL); 60 | const options = { 61 | hostname: parsedUrl.hostname, 62 | port: 443, 63 | path: parsedUrl.path, 64 | method: 'PUT', 65 | headers: { 66 | 'Content-Type': '', 67 | 'Content-Length': responseBody.length, 68 | } 69 | }; 70 | 71 | const req = https.request(options, (res) => { 72 | console.log('STATUS:', res.statusCode); 73 | console.log('HEADERS:', JSON.stringify(res.headers)); 74 | callback(null, 'Successfully sent stack response!'); 75 | }); 76 | 77 | req.on('error', (err) => { 78 | console.log('sendResponse Error:\n', err); 79 | callback(err); 80 | }); 81 | 82 | req.write(responseBody); 83 | req.end(); 84 | }; -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guidelines 2 | 3 | Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional 4 | documentation, we greatly value feedback and contributions from our community. 5 | 6 | Please read through this document before submitting any issues or pull requests to ensure we have all the necessary 7 | information to effectively respond to your bug report or contribution. 8 | 9 | 10 | ## Reporting Bugs/Feature Requests 11 | 12 | We welcome you to use the GitHub issue tracker to report bugs or suggest features. 13 | 14 | When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already 15 | reported the issue. Please try to include as much information as you can. Details like these are incredibly useful: 16 | 17 | * A reproducible test case or series of steps 18 | * The version of our code being used 19 | * Any modifications you've made relevant to the bug 20 | * Anything unusual about your environment or deployment 21 | 22 | 23 | ## Contributing via Pull Requests 24 | Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that: 25 | 26 | 1. You are working against the latest source on the *main* branch. 27 | 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. 28 | 3. You open an issue to discuss any significant work - we would hate for your time to be wasted. 29 | 30 | To send us a pull request, please: 31 | 32 | 1. Fork the repository. 33 | 2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change. 34 | 3. Ensure local tests pass. 35 | 4. Commit to your fork using clear commit messages. 36 | 5. Send us a pull request, answering any default questions in the pull request interface. 37 | 6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation. 38 | 39 | GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and 40 | [creating a pull request](https://help.github.com/articles/creating-a-pull-request/). 41 | 42 | 43 | ## Finding contributions to work on 44 | Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start. 45 | 46 | 47 | ## Code of Conduct 48 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 49 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 50 | opensource-codeofconduct@amazon.com with any additional questions or comments. 51 | 52 | 53 | ## Security issue notifications 54 | If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue. 55 | 56 | 57 | ## Licensing 58 | 59 | See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. 60 | -------------------------------------------------------------------------------- /website-creator/js/aws-cognito-helper.js: -------------------------------------------------------------------------------- 1 | console.log("Authenticating User"); 2 | var cognitoRegion = getRegion(); 3 | var cognitoUserPoolId = getCognitoUserPoolId(); 4 | var cognitoClientId = getCognitoClientId(); 5 | var userName ; 6 | var pass ; 7 | var userNameInPool; 8 | var idTokenForAPI; 9 | var authenticationData ; 10 | var cognitoIdentityPoolId = getCognitoIdentityPoolId(); 11 | var authenticationDetails ; 12 | var poolData; 13 | var userPool ; 14 | var userData ; 15 | var cognitoUser ; 16 | 17 | function authenticateUser(){ 18 | 19 | userName = $.trim($('#userName').val()); 20 | pass = $.trim($('#password').val()); 21 | userNameInPool = userName; 22 | authenticationData = { 23 | Username : userName, 24 | Password : pass, 25 | }; 26 | authenticationDetails = new AmazonCognitoIdentity.AuthenticationDetails(authenticationData); 27 | poolData = { UserPoolId : cognitoUserPoolId, 28 | ClientId : cognitoClientId 29 | }; 30 | userPool = new AmazonCognitoIdentity.CognitoUserPool(poolData); 31 | userData = { 32 | Username : userNameInPool, 33 | Pool : userPool 34 | }; 35 | cognitoUser = new AmazonCognitoIdentity.CognitoUser(userData); 36 | 37 | console.log(authenticationDetails); 38 | console.log(cognitoUser); 39 | cognitoUser.authenticateUser(authenticationDetails, { 40 | onSuccess: function (result) { 41 | console.log(result); 42 | console.log('Successfully logged in to user pool, now logging into identity pool'); 43 | var accessToken = result.getAccessToken().getJwtToken(); 44 | /* Use the idToken for Logins Map when Federating User Pools with identity pools or when passing through an Authorization Header to an API Gateway Authorizer*/ 45 | var idToken = result.idToken.jwtToken; 46 | idTokenForAPI = idToken; 47 | var logins = {}; 48 | logins["cognito-idp." + cognitoRegion + ".amazonaws.com/" + cognitoUserPoolId] = result.getIdToken().getJwtToken(); 49 | var params = { 50 | IdentityPoolId: cognitoIdentityPoolId, 51 | Logins: logins 52 | }; 53 | AWS.config.region = cognitoRegion; 54 | AWSCognito.config.region = cognitoRegion; 55 | //AWS.config.credentials.clearCachedId(); 56 | AWS.config.credentials = new AWS.CognitoIdentityCredentials(params); 57 | AWS.config.credentials.get(function(refreshErr) { 58 | if(refreshErr) { 59 | console.error('Failed to login', refreshErr); 60 | } 61 | else { 62 | console.log('Success logged into identity pool'); 63 | dialog.dialog( "close" ); 64 | //getAllUsers(); 65 | getAllPhoneNumbers(); 66 | } 67 | }); 68 | 69 | }, 70 | 71 | onFailure: function(err) { 72 | console.log('Error while authenticating', err); 73 | if(err.code == "NotAuthorizedException"){ 74 | $("#err1").html("Invalid username/password"); 75 | $('#err1').css('color', 'red'); 76 | } 77 | if(err.code == "UserNotFoundException"){ 78 | console.log('User is not confirmed, please contact your administrator'); 79 | $("#err1").html("Invalid username/password"); 80 | $('#err1').css('color', 'red'); 81 | } 82 | if(err.code == "PasswordResetRequiredException"){ 83 | console.log('User needs to reset password'); 84 | dialog.dialog( "close" ); 85 | $( "#dialog-form2" ).css("visibility", "visible"); 86 | $( "#divPasswordPasscode" ).css("visibility", "visible"); 87 | $("#err2").html("Reset your password with the passcode that you received"); 88 | $('#err2').css('color', 'red'); 89 | dialog2.dialog( "open" ); 90 | } 91 | }, 92 | newPasswordRequired: function(userAttributes, requiredAttributes){ 93 | console.log('Complete New Password Challenge'); 94 | dialog.dialog( "close" ); 95 | $( "#dialog-form2" ).css("visibility", "visible") 96 | dialog2.dialog( "open" ); 97 | 98 | } 99 | }); 100 | } 101 | 102 | function completeNewPasswordChallenge(){ 103 | var attributesData = {}; 104 | console.log('Changing password'); 105 | var password = $.trim($('#password2').val()); 106 | var passcode = $.trim($('#passcode').val()); 107 | 108 | if(passcode.length === 0 && isBlank(passcode) && passcode.isEmpty() ){ 109 | cognitoUser.completeNewPasswordChallenge(password, attributesData, { 110 | onSuccess: (result) => { 111 | console.log("NEW PASSWORD COMPLETED: "); 112 | console.log(result); 113 | dialog2.dialog( "close" ); 114 | location.reload(); 115 | }, 116 | onFailure: (err) => { 117 | console.log(err); 118 | } 119 | }); 120 | } else { 121 | if(handleConfirmForgetPassword(userName, password, passcode) === true) { 122 | location.reload(); 123 | } else { 124 | $("#err2").html("Could not forget password, please contact admin"); 125 | $('#err2').css('color', 'red'); 126 | } 127 | } 128 | 129 | } 130 | 131 | async function handleConfirmForgetPassword(username, password, passcode) { 132 | try { 133 | console.log('Changing password with passcode'); 134 | var resp = await confirmForgetPassword(username, password, passcode); 135 | console.log(resp); 136 | location.reload(); 137 | return true; 138 | 139 | } catch(e) { 140 | console.log(e); 141 | return false; 142 | } 143 | } 144 | 145 | async function handleForgetPassword(username) { 146 | try { 147 | var resp = await forgotPassword(username); 148 | console.log(resp); 149 | return true; 150 | 151 | } catch(e) { 152 | console.log(e); 153 | return false; 154 | } 155 | } 156 | 157 | const forgotPassword = (username) => { 158 | return new Promise((resolve,reject) => { 159 | cognitoUser.forgotPassword(username, function (err, res) { 160 | if (err) 161 | reject(err); 162 | else 163 | resolve(res); 164 | }); 165 | }); 166 | } 167 | 168 | 169 | const confirmForgetPassword = (username, password, confirmationCode) => { 170 | return new Promise((resolve,reject) => { 171 | AWS.config.region = cognitoRegion; 172 | var cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider(); 173 | var params = { 174 | ClientId: getCognitoClientId(), /* required */ 175 | ConfirmationCode: confirmationCode, /* required */ 176 | Password: password, /* required */ 177 | Username: username 178 | }; 179 | cognitoidentityserviceprovider.confirmForgotPassword(params, function (err, data) { 180 | if (err) 181 | reject(err); 182 | else 183 | resolve(data); 184 | }); 185 | }); 186 | } 187 | 188 | 189 | function changePassword(){ 190 | var pass2 = $.trim($('#password2').val()); 191 | cognitoUser.changePassword(pass2, pass2, function(err, result) { 192 | if (err) { 193 | console.log(err) 194 | return; 195 | } 196 | console.log('call result: ' + result); 197 | }); 198 | } -------------------------------------------------------------------------------- /website-creator/website-helper.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let AWS = require('aws-sdk'); 4 | let s3 = new AWS.S3(); 5 | const fs = require('fs'); 6 | const _downloadLocation = './web-site-manifest.json'; 7 | 8 | /** 9 | * Helper function to interact with s3 hosted website for cfn custom resource. 10 | * 11 | * @class websiteHelper 12 | */ 13 | let websiteHelper = (function() { 14 | 15 | /** 16 | * @class websiteHelper 17 | * @constructor 18 | */ 19 | let websiteHelper = function() {}; 20 | 21 | websiteHelper.prototype.copyWebSiteAssets = function(resourceProperties, cb) { 22 | var destS3Bucket = resourceProperties.destS3Bucket; 23 | var destS3KeyPrefix = resourceProperties.destS3KeyPrefix; 24 | var region = resourceProperties.Region; 25 | var identityPoolId = resourceProperties.identityPoolId; 26 | var userPoolID = resourceProperties.userPoolID; 27 | var appClientId = resourceProperties.appClientId; 28 | var instanceARN = resourceProperties.instanceARN; 29 | 30 | console.log("Copying UI web site"); 31 | console.log(['destination bucket:', destS3Bucket].join(' ')); 32 | console.log(['destination s3 key prefix:', destS3KeyPrefix].join(' ')); 33 | console.log(['region:', region].join(' ')); 34 | console.log(['identityPoolId:', identityPoolId].join(' ')); 35 | console.log(['userPoolID:', userPoolID].join(' ')); 36 | console.log(['appClientId:', appClientId].join(' ')); 37 | console.log(['instanceARN:', instanceARN].join(' ')); 38 | 39 | fs.readFile(_downloadLocation, 'utf8', function(err, data) { 40 | if (err) { 41 | console.log(err); 42 | return cb(err, null); 43 | } 44 | 45 | console.log(data); 46 | let _manifest = validateJSON(data); 47 | 48 | if (!_manifest) { 49 | return cb('Unable to validate downloaded manifest file JSON', null); 50 | } else { 51 | uploadToS3(_manifest.files, 0, destS3Bucket, destS3KeyPrefix, 52 | function(err, result) { 53 | if (err) { 54 | return cb(err, null); 55 | } 56 | console.log(result); 57 | createAWSCredentials(destS3Bucket, destS3KeyPrefix, region, identityPoolId, userPoolID, appClientId, instanceARN, 58 | function(err, createResult) { 59 | if (err) { 60 | return cb(err, null); 61 | } 62 | return cb(null, createResult); 63 | }); 64 | }); 65 | } 66 | 67 | }); 68 | }; 69 | 70 | let createAWSCredentials = function(destS3Bucket, destS3KeyPrefix, region, identityPoolId, userPoolID, appClientId, instanceARN, cb) { 71 | let str = ""; 72 | str+= " function getRegion(){ \n"; 73 | str+= " return '" + region + "';\n"; 74 | str+= " } \n\n"; 75 | 76 | str+= " function getCognitoIdentityPoolId(){ \n"; 77 | str+= " return '" + identityPoolId + "';\n"; 78 | str+= " } \n\n"; 79 | 80 | str+= " function getCognitoUserPoolId(){ \n"; 81 | str+= " return '" + userPoolID + "';\n"; 82 | str+= " } \n\n"; 83 | 84 | str+= " function getCognitoClientId(){ \n"; 85 | str+= " return '" + appClientId + "';\n"; 86 | str+= " } \n\n"; 87 | const instanceId = instanceARN.split("/"); 88 | console.log('Instance Id : ' + instanceId[1]); 89 | str+= " function getInstanceId(){ \n"; 90 | str+= " return '" + instanceARN + "';\n"; 91 | str+= " } \n\n"; 92 | 93 | //console.log(str); 94 | let params = { 95 | Bucket: destS3Bucket, 96 | Key: destS3KeyPrefix + '/js/aws-cognito-config.js', 97 | ContentType : "application/javascript", 98 | Body: str 99 | }; 100 | 101 | s3.putObject(params, function(err, data) { 102 | if (err) { 103 | console.log(err); 104 | return cb('error creating ' +destS3Bucket+ ' ' + destS3KeyPrefix + '/js/aws-cognito-config.js file for website UI', null); 105 | } 106 | console.log('Completed uploading aws-cognito-config.js') 107 | console.log(data); 108 | return cb(null, data); 109 | }); 110 | }; 111 | 112 | /** 113 | * Helper function to validate the JSON structure of contents of an import manifest file. 114 | * @param {string} body - JSON object stringify-ed. 115 | * @returns {JSON} - The JSON parsed string or null if string parsing failed 116 | */ 117 | let validateJSON = function(body) { 118 | try { 119 | let data = JSON.parse(body); 120 | console.log(data); 121 | return data; 122 | } catch (e) { 123 | // failed to parse 124 | console.log('Manifest file contains invalid JSON.'); 125 | return null; 126 | } 127 | }; 128 | 129 | async function uploadToS3(filelist, index, destS3Bucket, destS3KeyPrefix, cb) { 130 | if (filelist.length > index) { 131 | 132 | const response = fs.readFileSync(filelist[index], 'utf8'); 133 | var fileDetails = filelist[index] 134 | fileDetails = fileDetails.substring(2, fileDetails.length); 135 | 136 | let params2 = { 137 | Bucket: destS3Bucket, 138 | Key: destS3KeyPrefix + '/' + fileDetails, 139 | Body: response 140 | }; 141 | if (filelist[index].endsWith('.htm') || filelist[index].endsWith('.html')) { 142 | params2.ContentType = "text/html"; 143 | } else if (filelist[index].endsWith('.css')) { 144 | params2.ContentType = "text/css"; 145 | } else if (filelist[index].endsWith('.js')) { 146 | params2.ContentType = "application/javascript"; 147 | } else if (filelist[index].endsWith('.png')) { 148 | params2.ContentType = "image/png"; 149 | } else if (filelist[index].endsWith('.jpg') || filelist[index].endsWith('.jpeg')) { 150 | params2.ContentType = "image/jpeg"; 151 | } else if (filelist[index].endsWith('.pdf')) { 152 | params2.ContentType = "application/pdf"; 153 | } else if (filelist[index].endsWith('.gif')) { 154 | params2.ContentType = "image/gif"; 155 | } else if (filelist[index].endsWith('.svg')) { 156 | params2.ContentType = "image/svg+xml"; 157 | }; 158 | 159 | s3.putObject(params2, function(err, data) { 160 | if (err) { 161 | console.log(err); 162 | return cb(['error copying ', [filelist[index]].join('/'), '\n', err] 163 | .join( 164 | ''), 165 | null); 166 | } 167 | 168 | console.log([ 169 | [filelist[index]].join('/'), 'uploaded successfully' 170 | ].join(' ')); 171 | let _next = index + 1; 172 | uploadToS3(filelist, _next, destS3Bucket, destS3KeyPrefix, function(err, resp) { 173 | if (err) { 174 | return cb(err, null); 175 | } 176 | 177 | cb(null, resp); 178 | }); 179 | }); 180 | } else { 181 | cb(null, [index, 'files copied'].join(' ')); 182 | } 183 | } 184 | return websiteHelper; 185 | 186 | })(); 187 | 188 | module.exports = websiteHelper; -------------------------------------------------------------------------------- /website-creator/css/style.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | border: 0; 4 | margin: 0; 5 | padding: 0; 6 | } 7 | 8 | body { 9 | font: 100% "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif; 10 | min-width: 100%; 11 | min-height: 101%; 12 | color: #666; 13 | background: #eee; 14 | } 15 | 16 | p, 17 | label, 18 | legend { 19 | font: 1em "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif; 20 | } 21 | 22 | h1 { 23 | margin: 10px 0 10px; 24 | font-size: 20px; 25 | color: #333333; 26 | } 27 | 28 | hr { 29 | color: inherit; 30 | height: 0; 31 | margin: 6px 0 6px 0; 32 | padding: 0; 33 | border: 1px solid #d9d9d9; 34 | border-style: none none solid; 35 | } 36 | 37 | section { 38 | display: block; 39 | width: 800px; 40 | margin: 10px auto; 41 | padding: 35px; 42 | border: 1px solid #cbcbcb; 43 | background-color: #FFF; 44 | -webkit-border-radius: 5px; 45 | -moz-border-radius: 5px; 46 | border-radius: 5px; 47 | box-shadow: 0 2px 5px rgba(50, 50, 50, 0.1); 48 | -webkit-box-shadow: 0 2px 5px rgba(50, 50, 50, 0.1); 49 | -moz-box-shadow: 0 2px 5px rgba(50, 50, 50, 0.1); 50 | } 51 | 52 | 53 | /* Special CSS for Call Controls Section */ 54 | 55 | fieldset.salesOrder { 56 | padding: 7px; 57 | } 58 | 59 | fieldset.callControls { 60 | padding: 3px; 61 | margin: 4px; 62 | -webkit-transition: margin-left 1s ease-in-out; 63 | z-index: 1; 64 | } 65 | 66 | .callControls { 67 | margin: 2px 2px; 68 | display: inline-block; 69 | border: 1px solid #bfbfbf; 70 | border-radius: 5px 5px 5px 5px; 71 | -webkit-border-radius: 5px 5px 5px 5px; 72 | -moz-border-radius: 5px 5px 5px 5px; 73 | font: 1em "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif; 74 | width: auto; 75 | height: auto; 76 | font-size: 16px; 77 | box-shadow: inset 0 1px 0 0 #fff, inset 0 -1px 0 0 #d9d9d9, inset 0 0 0 1px #f2f2f2, 0 2px 4px 0 #f2f2f2; 78 | -moz-box-shadow: inset 0 1px 0 0 #fff, inset 0 -1px 0 0 #d9d9d9, inset 0 0 0 1px #f2f2f2, 0 2px 4px 0 #f2f2f2; 79 | -webkit-box-shadow: inset 0 1px 0 0 #fff, inset 0 -1px 0 0 #d9d9d9, inset 0 0 0 1px #f2f2f2, 0 2px 4px 0 #f2f2f2; 80 | text-shadow: 0 1px 0 #fff; 81 | background-image: linear-gradient(to top, #f2f2f2, #f2f2f2); 82 | background-color: #f2f2f2; 83 | } 84 | 85 | .callControls:hover, 86 | .callControls:active { 87 | border: 1px solid #8c8c8c; 88 | color: #8c8c8c; 89 | box-shadow: inset 0 1px 0 0 #ffffff, inset 0 -1px 0 0 #d9d9d9, inset 0 0 0 1px #f2f2f2; 90 | -moz-box-shadow: inset 0 1px 0 0 #ffffff, inset 0 -1px 0 0 #d9d9d9, inset 0 0 0 1px #f2f2f2; 91 | -webkit-box-shadow: inset 0 1px 0 0 #ffffff, inset 0 -1px 0 0 #d9d9d9, inset 0 0 0 1px #f2f2f2; 92 | background-color: #f2f2f2; 93 | } 94 | 95 | 96 | /* Form style */ 97 | 98 | mark.validate { 99 | display: inline-block; 100 | margin: 12px 0 0 10px; 101 | width: 16px; 102 | height: 16px; 103 | background: transparent none; 104 | } 105 | 106 | mark.valid { 107 | background: url(images/success.gif) no-repeat top left; 108 | } 109 | 110 | mark.error { 111 | background: url(images/error.gif) no-repeat top left; 112 | } 113 | 114 | form label, 115 | section label { 116 | display: inline-block; 117 | float: left; 118 | height: 1em; 119 | line-height: 1em; 120 | padding: 6px 0 0; 121 | width: 135px; 122 | font-size: 1em; 123 | margin: 5px 0; 124 | clear: both; 125 | } 126 | 127 | form label small, 128 | section label small { 129 | font-size: 0.75em; 130 | color: #ccc; 131 | } 132 | 133 | form label.verify { 134 | padding: 0; 135 | margin: 2px 10px 2px 0; 136 | width: 145px; 137 | text-align: right; 138 | } 139 | 140 | form label.verify img { 141 | padding: 1px; 142 | border: 1px solid #cccccc; 143 | -webkit-border-radius: 3px; 144 | -moz-border-radius: 3px; 145 | border-radius: 3px; 146 | } 147 | 148 | form button { 149 | width: 120px; 150 | padding: 4px; 151 | color: #666; 152 | background: #f5f5f5; 153 | border: 1px solid #ccc; 154 | margin: 5px 0; 155 | font: 1em "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif; 156 | -webkit-border-radius: 5px; 157 | -moz-border-radius: 5px; 158 | border-radius: 5px; 159 | vertical-align: top; 160 | transition: all 0.25s ease-in-out; 161 | -webkit-transition: all 0.25s ease-in-out; 162 | -moz-transition: all 0.25s ease-in-out; 163 | box-shadow: 0 0 5px rgba(81, 203, 238, 0); 164 | -webkit-box-shadow: 0 0 5px rgba(81, 203, 238, 0); 165 | -moz-box-shadow: 0 0 5px rgba(81, 203, 238, 0); 166 | } 167 | 168 | form input, 169 | form textarea, 170 | form select, 171 | section select, 172 | section input, 173 | section textarea { 174 | width: 220px; 175 | padding: 5px; 176 | color: #666; 177 | background: #f5f5f5; 178 | border: 1px solid #ccc; 179 | margin: 5px 0; 180 | font: 1em "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif; 181 | -webkit-border-radius: 5px; 182 | -moz-border-radius: 5px; 183 | border-radius: 5px; 184 | vertical-align: top; 185 | transition: all 0.25s ease-in-out; 186 | -webkit-transition: all 0.25s ease-in-out; 187 | -moz-transition: all 0.25s ease-in-out; 188 | box-shadow: 0 0 5px rgba(81, 203, 238, 0); 189 | -webkit-box-shadow: 0 0 5px rgba(81, 203, 238, 0); 190 | -moz-box-shadow: 0 0 5px rgba(81, 203, 238, 0); 191 | } 192 | 193 | form select { 194 | width: 232px; 195 | margin: 8px 0; 196 | } 197 | 198 | form input#verify { 199 | width: 55px; 200 | } 201 | 202 | form textarea, 203 | section textarea { 204 | width: 414px; 205 | } 206 | 207 | form input:focus, 208 | form textarea:focus, 209 | form select:focus, 210 | form button:focus, 211 | section input:focus, 212 | section textarea:focus, 213 | section select:focus { 214 | border: 1px solid #ddd; 215 | background-color: #fff; 216 | color: #333; 217 | outline: none; 218 | position: relative; 219 | z-index: 5; 220 | box-shadow: 0 0 5px rgba(81, 203, 238, 1); 221 | -webkit-box-shadow: 0 0 5px rgba(81, 203, 238, 1); 222 | -moz-box-shadow: 0 0 5px rgba(81, 203, 238, 1); 223 | -webkit-transform: scale(1.05); 224 | -moz-transform: scale(1.05); 225 | transition: all 0.25s ease-in-out; 226 | -webkit-transition: all 0.25s ease-in-out; 227 | -moz-transition: all 0.25s ease-in-out; 228 | } 229 | 230 | form input.error, 231 | form textarea.error, 232 | form select.error { 233 | box-shadow: 0 0 5px rgba(204, 0, 0, 0.5); 234 | -webkit-box-shadow: 0 0 5px rgba(204, 0, 0, 0.5); 235 | -moz-box-shadow: 0 0 5px rgba(204, 0, 0, 0.5); 236 | border: 1px solid #faabab; 237 | background: #fef3f3 238 | } 239 | 240 | form input.submit { 241 | width: auto; 242 | cursor: pointer; 243 | position: relative; 244 | border: 1px solid #282828; 245 | color: #fff; 246 | padding: 6px 16px; 247 | text-decoration: none; 248 | font-size: 1.1em; 249 | background: #555; 250 | background: -webkit-gradient( linear, left bottom, left top, color-stop(0.12, rgb(60, 60, 60)), color-stop(1, rgb(85, 85, 85))); 251 | background: -moz-linear-gradient( center bottom, rgb(60, 60, 60) 12%, rgb(85, 85, 85) 100%); 252 | box-shadow: 0 2px 3px rgba(0, 0, 0, 0.25); 253 | -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); 254 | -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); 255 | text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.25); 256 | } 257 | 258 | form input.submit:hover { 259 | background: #282828 !important; 260 | transition: none; 261 | -webkit-transition: none; 262 | -moz-transition: none; 263 | } 264 | 265 | form input.submit:active, 266 | form input.submit:focus { 267 | top: 1px; 268 | } 269 | 270 | form button.delete-comment { 271 | width: auto; 272 | cursor: pointer; 273 | position: relative; 274 | border: 1px solid #282828; 275 | color: #fff; 276 | border-radius: 5px; 277 | padding: 6px 16px; 278 | text-decoration: none; 279 | font-size: 1.1em; 280 | background: #555; 281 | background: -webkit-gradient( linear, left bottom, left top, color-stop(0.12, rgb(60, 60, 60)), color-stop(1, rgb(85, 85, 85))); 282 | background: -moz-linear-gradient( center bottom, rgb(60, 60, 60) 12%, rgb(85, 85, 85) 100%); 283 | box-shadow: 0 2px 3px rgba(0, 0, 0, 0.25); 284 | -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); 285 | -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); 286 | text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.25); 287 | } 288 | 289 | .copy { 290 | width: 30px; 291 | height: 29px; 292 | padding: 5px; 293 | color: #666; 294 | background: #f5f5f5; 295 | border: 1px solid #ccc; 296 | margin: 5px 0; 297 | } 298 | 299 | form button.delete-comment:hover { 300 | background: #282828 !important; 301 | transition: none; 302 | -webkit-transition: none; 303 | -moz-transition: none; 304 | } 305 | 306 | form button.delete-comment:active, 307 | form button.delet-comment:focus { 308 | top: 1px; 309 | } 310 | 311 | form button:hover { 312 | background: #eeeeee; 313 | transition: none; 314 | -webkit-transition: none; 315 | -moz-transition: none; 316 | } 317 | 318 | form input[type="submit"][disabled] { 319 | background: #888; 320 | } 321 | 322 | form fieldset { 323 | padding: 7px; 324 | border: 1px solid #eee; 325 | -webkit-border-radius: 5px; 326 | -moz-border-radius: 5px; 327 | margin: 0 0 20px; 328 | } 329 | 330 | form legend { 331 | padding: 7px 10px; 332 | font-weight: bold; 333 | color: #000; 334 | border: 1px solid #eee; 335 | -webkit-border-radius: 5px; 336 | -moz-border-radius: 5px; 337 | margin-bottom: 0 !important; 338 | margin-bottom: 20px; 339 | } 340 | 341 | form span.required { 342 | font-size: 13px; 343 | color: #ff0000; 344 | } 345 | 346 | section span.required { 347 | font-size: 13px; 348 | color: #ff0000; 349 | } 350 | 351 | fieldset { 352 | padding: 20px; 353 | border: 1px solid #eee; 354 | -webkit-border-radius: 5px; 355 | -moz-border-radius: 5px; 356 | margin: 0 0 20px; 357 | } 358 | 359 | legend { 360 | padding: 7px 10px; 361 | font-weight: bold; 362 | color: #000; 363 | border: 1px solid #eee; 364 | -webkit-border-radius: 5px; 365 | -moz-border-radius: 5px; 366 | margin-bottom: 0 !important; 367 | margin-bottom: 20px; 368 | } 369 | 370 | #message { 371 | margin: 1em 0; 372 | padding: 0; 373 | display: block; 374 | background: transparent none; 375 | } 376 | 377 | acronym { 378 | border-bottom: 1px dotted #ccc; 379 | } -------------------------------------------------------------------------------- /template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: 2010-09-09 2 | Description: > 3 | Amazon Connect Phone number APIs demo 4 | 5 | Mappings: 6 | FunctionMap: 7 | Configuration: 8 | S3Bucket: "amazon-connect-blogs2" 9 | S3Key: "srrampra-Ram/programmatically-manange-phone-numbers-using-an-pi-in-amazon-connect/" 10 | 11 | Parameters: 12 | CFS3BucketForWebSite: 13 | Default: "phone-number-api-website" 14 | Type: String 15 | AllowedPattern: '(?=^.{3,63}$)(?!^(\d+\.)+\d+$)(^(([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)*([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])$)' 16 | ConstraintDescription: 'Invalid S3 Bucket name' 17 | Description: Enter the (globally unique) name you would like to use for the Amazon S3 bucket where we will store the website assets and the sample search user api. This template will fail to deploy if the bucket name you chose is currently in use. 18 | 19 | CFSInstanceARNParam: 20 | Default: "" 21 | Type: String 22 | ConstraintDescription: 'Invalid Amazon Connect Instance ARN' 23 | Description: "Amazon Connect Instance full ARN that you will have access to execute the search API" 24 | 25 | 26 | Metadata: 27 | 'AWS::CloudFormation::Interface': 28 | ParameterGroups: 29 | - Label: 30 | default: Amazon S3 Configuration 31 | Parameters: 32 | - CFS3BucketForWebSite 33 | - Label: 34 | default: Amazon Connect Instance Configuration 35 | Parameters: 36 | - CFSInstanceARNParam 37 | ParameterLabels: 38 | CFS3BucketForWebSite: 39 | default: "S3 bucket name" 40 | CFSInstanceARNParam: 41 | default: "Amazon Connect ARN" 42 | 43 | Outputs: 44 | CloudfrontEndpoint: 45 | Description: Endpoint for Cloudfront distribution 46 | Value: !Join 47 | - '' 48 | - - 'https://' 49 | - !GetAtt [CFCloudFrontDistribution, DomainName] 50 | - '/phoneNumber.html' 51 | 52 | Resources: 53 | 54 | createWebSiteS3Bucket: 55 | Type: 'AWS::S3::Bucket' 56 | Properties: 57 | BucketName: !Ref CFS3BucketForWebSite 58 | VersioningConfiguration: 59 | Status : Enabled 60 | BucketEncryption: 61 | ServerSideEncryptionConfiguration: 62 | - ServerSideEncryptionByDefault: 63 | SSEAlgorithm: AES256 64 | PublicAccessBlockConfiguration: 65 | BlockPublicAcls: True 66 | BlockPublicPolicy: True 67 | IgnorePublicAcls: True 68 | RestrictPublicBuckets: True 69 | WebsiteConfiguration: 70 | IndexDocument: phoneNumber.html 71 | ErrorDocument: error.html 72 | 73 | 74 | CFS3BucketPolicy: 75 | Type: AWS::S3::BucketPolicy 76 | DependsOn: 77 | - CFCloudFrontDistributionAccessIdentity 78 | Properties: 79 | Bucket: !Ref createWebSiteS3Bucket 80 | PolicyDocument: 81 | Statement: 82 | - 83 | Action: 84 | - "s3:GetObject" 85 | Effect: "Allow" 86 | Principal: 87 | CanonicalUser: 88 | Fn::GetAtt: [ CFCloudFrontDistributionAccessIdentity , S3CanonicalUserId ] 89 | Resource: 90 | !Sub ${createWebSiteS3Bucket.Arn}/phonenumber-site/* 91 | 92 | CFCloudFrontDistributionAccessIdentity: 93 | Type: AWS::CloudFront::CloudFrontOriginAccessIdentity 94 | Properties: 95 | CloudFrontOriginAccessIdentityConfig: 96 | Comment: 'CloudFront endpoint for Search User API s3' 97 | 98 | CFCloudFrontDistribution: 99 | Type: AWS::CloudFront::Distribution 100 | Properties: 101 | DistributionConfig: 102 | Origins: 103 | - DomainName: 104 | !Join 105 | - '' 106 | - - !Ref CFS3BucketForWebSite 107 | - .s3.amazonaws.com 108 | Id: !Ref CFS3BucketForWebSite 109 | OriginPath: '/phonenumber-site' 110 | S3OriginConfig: 111 | OriginAccessIdentity: 112 | !Join 113 | - '' 114 | - - 'origin-access-identity/cloudfront/' 115 | - !Ref CFCloudFrontDistributionAccessIdentity 116 | Enabled: 'true' 117 | Logging: 118 | Bucket: !GetAtt createWebSiteS3Bucket.DomainName 119 | Prefix: 'logs/' 120 | IncludeCookies: 'true' 121 | Comment: CloudFront for Search User API 122 | DefaultRootObject: phoneNumber.html 123 | DefaultCacheBehavior: 124 | AllowedMethods: 125 | - DELETE 126 | - GET 127 | - HEAD 128 | - OPTIONS 129 | - PATCH 130 | - POST 131 | - PUT 132 | TargetOriginId: !Ref CFS3BucketForWebSite 133 | ForwardedValues: 134 | QueryString: true 135 | Cookies: 136 | Forward: all 137 | ViewerProtocolPolicy: redirect-to-https 138 | Restrictions: 139 | GeoRestriction: 140 | RestrictionType: whitelist 141 | Locations: 142 | - US 143 | 144 | CFWebsiteCreatorRole: 145 | Type: "AWS::IAM::Role" 146 | Properties: 147 | AssumeRolePolicyDocument: 148 | Version: "2012-10-17" 149 | Statement: 150 | - 151 | Effect: "Allow" 152 | Principal: 153 | Service: 154 | - "lambda.amazonaws.com" 155 | Action: 156 | - "sts:AssumeRole" 157 | Path: "/" 158 | Policies: 159 | - 160 | PolicyName: !Sub ${AWS::StackName}-phoneNumber-creator-policy 161 | PolicyDocument: 162 | Version: "2012-10-17" 163 | Statement: 164 | - 165 | Effect: "Allow" 166 | Action: 167 | - 'logs:CreateLogGroup' 168 | - 'logs:CreateLogStream' 169 | - 'logs:PutLogEvents' 170 | Resource: 171 | - !Sub "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/*" 172 | - 173 | Effect: "Allow" 174 | Action: 175 | - "s3:PutObject" 176 | - "s3:GetObject" 177 | - "s3:PutObjectAcl" 178 | Resource: 179 | - !Join 180 | - '' 181 | - - 'arn:' 182 | - !Ref 'AWS::Partition' 183 | - ':s3:::' 184 | - !Ref CFS3BucketForWebSite 185 | - '/*' 186 | - 187 | Effect: "Allow" 188 | Action: 189 | - "s3:PutBucketPublicAccessBlock" 190 | Resource: 191 | - !Join 192 | - '' 193 | - - 'arn:' 194 | - !Ref 'AWS::Partition' 195 | - ':s3:::' 196 | - !Ref CFS3BucketForWebSite 197 | - 198 | Effect: "Allow" 199 | Action: 200 | - "s3:GetObject" 201 | Resource: 202 | - !Join 203 | - '' 204 | - - 'arn:' 205 | - !Ref 'AWS::Partition' 206 | - ':s3:::' 207 | - 'amazon-connect-blogs2' 208 | - '/*' 209 | 210 | webSiteCreator: 211 | Type: "AWS::Lambda::Function" 212 | Properties: 213 | Description: > 214 | AWS Lambda Function that will create the website and upload it to the S3 bucket 215 | Handler: "index.handler" 216 | Role: !GetAtt CFWebsiteCreatorRole.Arn 217 | Runtime: "nodejs14.x" 218 | MemorySize: 256 219 | Timeout: 120 220 | Code: ./website-creator 221 | 222 | invokeWebSiteCreator: 223 | Type: Custom::CreateWebSite 224 | DependsOn: createWebSiteS3Bucket 225 | Properties: 226 | ServiceToken: !GetAtt webSiteCreator.Arn 227 | customAction: configureWebsite 228 | Region: !Ref AWS::Region 229 | destS3Bucket: !Ref CFS3BucketForWebSite 230 | destS3KeyPrefix: phonenumber-site 231 | identityPoolId: !Ref BlogCognitoIDPool 232 | userPoolID: !Ref BlogUserPool 233 | appClientId: !Ref BlogUserPoolClient 234 | instanceARN : !Ref CFSInstanceARNParam 235 | 236 | SNSRole: 237 | Type: "AWS::IAM::Role" 238 | Properties: 239 | AssumeRolePolicyDocument: 240 | Version: "2012-10-17" 241 | Statement: 242 | - Effect: "Allow" 243 | Principal: 244 | Service: 245 | - "cognito-idp.amazonaws.com" 246 | Action: 247 | - "sts:AssumeRole" 248 | Policies: 249 | - PolicyName: !Sub ${AWS::StackName}-blog-userpool-su-sns-policy 250 | PolicyDocument: 251 | Version: "2012-10-17" 252 | Statement: 253 | - Effect: "Allow" 254 | Action: "sns:publish" 255 | Resource: "*" 256 | 257 | BlogUserPool: 258 | Type: "AWS::Cognito::UserPool" 259 | Properties: 260 | UserPoolName: !Join 261 | - '' 262 | - - !Ref AWS::StackName 263 | - "-blog-user-pool" 264 | AutoVerifiedAttributes: 265 | - phone_number 266 | - email 267 | MfaConfiguration: "OFF" 268 | SmsConfiguration: 269 | ExternalId: !Sub blog-phonenumber-client 270 | SnsCallerArn: !GetAtt SNSRole.Arn 271 | Policies: 272 | PasswordPolicy: 273 | MinimumLength: 8 274 | RequireLowercase: False 275 | RequireNumbers: False 276 | RequireSymbols: False 277 | RequireUppercase: False 278 | 279 | BlogUserPoolClient: 280 | Type: "AWS::Cognito::UserPoolClient" 281 | Properties: 282 | ClientName: blog-phonenumber-client 283 | GenerateSecret: false 284 | UserPoolId: !Ref BlogUserPool 285 | 286 | BlogCognitoIDPool: 287 | Type: 'AWS::Cognito::IdentityPool' 288 | Properties: 289 | AllowUnauthenticatedIdentities: true 290 | CognitoIdentityProviders: 291 | - ClientId: !Ref BlogUserPoolClient 292 | ProviderName: !GetAtt BlogUserPool.ProviderName 293 | 294 | BlogCognitoIDIamRoleAuth: 295 | Type: 'AWS::IAM::Role' 296 | Properties: 297 | AssumeRolePolicyDocument: 298 | Version: 2012-10-17 299 | Statement: 300 | - Effect: Allow 301 | Principal: 302 | Federated: 303 | - cognito-identity.amazonaws.com 304 | Action: 305 | - 'sts:AssumeRoleWithWebIdentity' 306 | Condition: { "ForAnyValue:StringLike": {"cognito-identity.amazonaws.com:amr": "authenticated" }, "StringEquals": {"cognito-identity.amazonaws.com:aud": !Ref BlogCognitoIDPool}} 307 | 308 | Path: / 309 | Policies: 310 | - PolicyName: !Sub ${AWS::StackName}-blog-searchuser-cognito-identity-authenticated 311 | PolicyDocument: 312 | Version: 2012-10-17 313 | Statement: 314 | - 315 | Effect: "Allow" 316 | Action: 317 | - "connect:ClaimPhoneNumber" 318 | Resource: !Sub ${CFSInstanceARNParam} 319 | - 320 | Effect: "Allow" 321 | Action: 322 | - "connect:AssociatePhoneNumberContactFlow" 323 | - "connect:ListContactFlows" 324 | Resource: !Sub "${CFSInstanceARNParam}/contact-flow/*" 325 | - 326 | Effect: "Allow" 327 | Action: 328 | - "connect:ClaimPhoneNumber" 329 | - "connect:ReleasePhoneNumber" 330 | - "connect:AssociatePhoneNumberContactFlow" 331 | - "connect:DisassociatePhoneNumberContactFlow" 332 | - "connect:ListPhoneNumbers" 333 | - "connect:ListPhoneNumbersV2" 334 | - "connect:SearchAvailablePhoneNumbers" 335 | - "connect:DescribePhoneNumber" 336 | Resource: !Sub "arn:aws:connect:${AWS::Region}:${AWS::AccountId}:phone-number/*" 337 | 338 | - Effect: Allow 339 | Action: 340 | - 'mobileanalytics:PutEvents' 341 | Resource: '*' 342 | 343 | BlogCognitoIDIamRoleUnAuth: 344 | Type: 'AWS::IAM::Role' 345 | Properties: 346 | AssumeRolePolicyDocument: 347 | Version: 2012-10-17 348 | Statement: 349 | - Effect: Allow 350 | Principal: 351 | Federated: 352 | - cognito-identity.amazonaws.com 353 | Action: 354 | - 'sts:AssumeRoleWithWebIdentity' 355 | Condition: { "ForAnyValue:StringLike": {"cognito-identity.amazonaws.com:amr": "unauthenticated" }, "StringEquals": {"cognito-identity.amazonaws.com:aud": !Ref BlogCognitoIDPool}} 356 | 357 | Path: / 358 | Policies: 359 | - PolicyName: !Sub ${AWS::StackName}-blog-searchuser-cognito-identity-unauthenticated 360 | PolicyDocument: 361 | Version: 2012-10-17 362 | Statement: 363 | - Effect: Allow 364 | Action: 365 | - 'mobileanalytics:PutEvents' 366 | Resource: '*' 367 | 368 | BlogCognitoIDIamRoleAttachment: 369 | Type: "AWS::Cognito::IdentityPoolRoleAttachment" 370 | Properties: 371 | IdentityPoolId: !Ref BlogCognitoIDPool 372 | Roles: {"authenticated": !GetAtt BlogCognitoIDIamRoleAuth.Arn, "unauthenticated": !GetAtt BlogCognitoIDIamRoleUnAuth.Arn} -------------------------------------------------------------------------------- /website-creator/phoneNumber.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 |Are you sure you want to delete the quick connect?
330 |All form fields are required.
333 | 334 | 346 |All form fields are required., please change your password
350 | 351 | 364 |