|
| 1 | +# Creating an Amazon Connect instance using the AWS CLI |
| 2 | + |
| 3 | +Set up a cloud-based contact center with Amazon Connect |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +Before you begin this tutorial, you need: |
| 8 | + |
| 9 | +* An AWS account with permissions to create Amazon Connect resources |
| 10 | +* The AWS CLI installed and configured. For installation instructions, see [Installing or updating the latest version of the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html). |
| 11 | +* The `AmazonConnect_FullAccess` managed policy attached to your IAM user or role (for production environments, consider using more restrictive permissions) |
| 12 | +* Basic familiarity with command line interfaces and JSON formatting |
| 13 | +* Approximately 15-20 minutes to complete the tutorial |
| 14 | + |
| 15 | +## Cost estimate |
| 16 | + |
| 17 | +This tutorial creates resources that may incur charges to your AWS account: |
| 18 | + |
| 19 | +* Amazon Connect phone number: $1.00 per month for a toll-free number in the US |
| 20 | +* No charges for the Amazon Connect instance itself |
| 21 | +* No charges for creating users or configuring the instance |
| 22 | +* S3 storage for call recordings and chat transcripts: Standard S3 rates apply (approximately $0.023 per GB per month) |
| 23 | +* KMS key usage for encryption: $1.00 per month per key plus $0.03 per 10,000 API requests |
| 24 | + |
| 25 | +Total estimated cost: Less than $0.01 for completing the tutorial if you clean up resources afterward. If you keep the resources running, expect to pay approximately $1.00 per month for the phone number plus any applicable storage costs. |
| 26 | + |
| 27 | +## Create an Amazon Connect instance |
| 28 | + |
| 29 | +The first step is to create a new Amazon Connect instance. When creating an instance, you need to specify how you want to manage user identities. |
| 30 | + |
| 31 | +**To create an Amazon Connect instance:** |
| 32 | + |
| 33 | +```bash |
| 34 | +aws connect create-instance \ |
| 35 | + --identity-management-type CONNECT_MANAGED \ |
| 36 | + --instance-alias my-contact-center \ |
| 37 | + --inbound-calls-enabled \ |
| 38 | + --outbound-calls-enabled |
| 39 | +``` |
| 40 | + |
| 41 | +This command creates an instance with the following configuration: |
| 42 | +- Identity management type: CONNECT_MANAGED (users stored in Amazon Connect) |
| 43 | +- Instance alias: my-contact-center (this will be part of your access URL) |
| 44 | +- Inbound and outbound calls enabled |
| 45 | + |
| 46 | +The command returns the instance ID and ARN, which you'll need for subsequent commands: |
| 47 | + |
| 48 | +```json |
| 49 | +{ |
| 50 | + "Id": "abcd1234-a123-4567-xmpl-a123b4cd56ef", |
| 51 | + "Arn": "arn:aws:connect:us-west-2:123456789012:instance/abcd1234-a123-4567-xmpl-a123b4cd56ef" |
| 52 | +} |
| 53 | +``` |
| 54 | + |
| 55 | +After creating the instance, you need to wait for it to become active before proceeding. This may take several minutes. |
| 56 | + |
| 57 | +**To check the instance status:** |
| 58 | + |
| 59 | +```bash |
| 60 | +aws connect describe-instance \ |
| 61 | + --instance-id abcd1234-a123-4567-xmpl-a123b4cd56ef |
| 62 | +``` |
| 63 | + |
| 64 | +Wait until the `InstanceStatus` field shows `ACTIVE` before proceeding to the next step. |
| 65 | + |
| 66 | +## Configure an administrator user |
| 67 | + |
| 68 | +After your instance is active, you need to create an administrator user. First, you need to get the security profile ID for the Admin role and a routing profile ID. |
| 69 | + |
| 70 | +**To list security profiles:** |
| 71 | + |
| 72 | +```bash |
| 73 | +aws connect list-security-profiles \ |
| 74 | + --instance-id abcd1234-a123-4567-xmpl-a123b4cd56ef |
| 75 | +``` |
| 76 | + |
| 77 | +Find the ID of the Admin security profile in the output: |
| 78 | + |
| 79 | +```json |
| 80 | +{ |
| 81 | + "SecurityProfileSummaryList": [ |
| 82 | + { |
| 83 | + "Id": "abcd1234-a123-4567-xmpl-a123b4cd56ef", |
| 84 | + "Arn": "arn:aws:connect:us-west-2:123456789012:instance/abcd1234-a123-4567-xmpl-a123b4cd56ef/security-profile/abcd1234-a123-4567-xmpl-a123b4cd56ef", |
| 85 | + "SecurityProfileName": "Admin" |
| 86 | + }, |
| 87 | + ... |
| 88 | + ] |
| 89 | +} |
| 90 | +``` |
| 91 | + |
| 92 | +**To list routing profiles:** |
| 93 | + |
| 94 | +```bash |
| 95 | +aws connect list-routing-profiles \ |
| 96 | + --instance-id abcd1234-a123-4567-xmpl-a123b4cd56ef |
| 97 | +``` |
| 98 | + |
| 99 | +Note the ID of a routing profile from the output: |
| 100 | + |
| 101 | +```json |
| 102 | +{ |
| 103 | + "RoutingProfileSummaryList": [ |
| 104 | + { |
| 105 | + "Id": "abcd1234-a123-4567-xmpl-a123b4cd56ef", |
| 106 | + "Arn": "arn:aws:connect:us-west-2:123456789012:instance/abcd1234-a123-4567-xmpl-a123b4cd56ef/routing-profile/abcd1234-a123-4567-xmpl-a123b4cd56ef", |
| 107 | + "Name": "Basic Routing Profile" |
| 108 | + }, |
| 109 | + ... |
| 110 | + ] |
| 111 | +} |
| 112 | +``` |
| 113 | + |
| 114 | +Now you can create an administrator user: |
| 115 | + |
| 116 | +**To create an admin user:** |
| 117 | + |
| 118 | +```bash |
| 119 | +aws connect create-user \ |
| 120 | + --instance-id abcd1234-a123-4567-xmpl-a123b4cd56ef \ |
| 121 | + --username admin \ |
| 122 | + --password "StrongPassword123!" \ |
| 123 | + --identity-info FirstName=Admin,LastName=User,Email=admin@example.com \ |
| 124 | + --phone-config PhoneType=DESK_PHONE,AutoAccept=true,AfterContactWorkTimeLimit=30,DeskPhoneNumber=+12065550100 \ |
| 125 | + --security-profile-ids abcd1234-a123-4567-xmpl-a123b4cd56ef \ |
| 126 | + --routing-profile-id abcd1234-a123-4567-xmpl-a123b4cd56ef |
| 127 | +``` |
| 128 | + |
| 129 | +Make sure to replace the security profile ID and routing profile ID with the values you obtained from the previous commands. Also, use a strong, unique password instead of the example shown. |
| 130 | + |
| 131 | +The command returns the user ID and ARN: |
| 132 | + |
| 133 | +```json |
| 134 | +{ |
| 135 | + "UserId": "abcd1234-a123-4567-xmpl-a123b4cd56ef", |
| 136 | + "UserArn": "arn:aws:connect:us-west-2:123456789012:instance/abcd1234-a123-4567-xmpl-a123b4cd56ef/agent/abcd1234-a123-4567-xmpl-a123b4cd56ef" |
| 137 | +} |
| 138 | +``` |
| 139 | + |
| 140 | +## Configure telephony options |
| 141 | + |
| 142 | +After creating your instance and administrator user, you can configure telephony options for your contact center. |
| 143 | + |
| 144 | +**To enable early media audio:** |
| 145 | + |
| 146 | +```bash |
| 147 | +aws connect update-instance-attribute \ |
| 148 | + --instance-id abcd1234-a123-4567-xmpl-a123b4cd56ef \ |
| 149 | + --attribute-type EARLY_MEDIA \ |
| 150 | + --value true |
| 151 | +``` |
| 152 | + |
| 153 | +Early media allows your agents to hear pre-connection audio such as busy signals or failure-to-connect errors during outbound calls. |
| 154 | + |
| 155 | +**To enable multi-party calls and enhanced monitoring for voice:** |
| 156 | + |
| 157 | +```bash |
| 158 | +aws connect update-instance-attribute \ |
| 159 | + --instance-id abcd1234-a123-4567-xmpl-a123b4cd56ef \ |
| 160 | + --attribute-type MULTI_PARTY_CONFERENCE \ |
| 161 | + --value true |
| 162 | +``` |
| 163 | + |
| 164 | +This enables up to six participants on a call. |
| 165 | + |
| 166 | +**To enable multi-party chats and enhanced monitoring for chat:** |
| 167 | + |
| 168 | +```bash |
| 169 | +aws connect update-instance-attribute \ |
| 170 | + --instance-id abcd1234-a123-4567-xmpl-a123b4cd56ef \ |
| 171 | + --attribute-type MULTI_PARTY_CHAT_CONFERENCE \ |
| 172 | + --value true |
| 173 | +``` |
| 174 | + |
| 175 | +This enables up to six participants on a chat. |
| 176 | + |
| 177 | +## View data storage configurations |
| 178 | + |
| 179 | +Amazon Connect automatically creates storage configurations for various data types. You can view these configurations to understand where your data is stored. |
| 180 | + |
| 181 | +**To list storage configurations for chat transcripts:** |
| 182 | + |
| 183 | +```bash |
| 184 | +aws connect list-instance-storage-configs \ |
| 185 | + --instance-id abcd1234-a123-4567-xmpl-a123b4cd56ef \ |
| 186 | + --resource-type CHAT_TRANSCRIPTS |
| 187 | +``` |
| 188 | + |
| 189 | +The command returns information about the S3 bucket where chat transcripts are stored: |
| 190 | + |
| 191 | +```json |
| 192 | +{ |
| 193 | + "StorageConfigs": [ |
| 194 | + { |
| 195 | + "AssociationId": "abcd1234-a123-4567-xmpl-a123b4cd56ef", |
| 196 | + "StorageType": "S3", |
| 197 | + "S3Config": { |
| 198 | + "BucketName": "amzn-s3-demo-connect-abcd1234", |
| 199 | + "BucketPrefix": "connect/instance-id/chat-transcripts", |
| 200 | + "EncryptionConfig": { |
| 201 | + "EncryptionType": "KMS", |
| 202 | + "KeyId": "arn:aws:kms:us-west-2:123456789012:key/abcd1234-a123-4567-xmpl-a123b4cd56ef" |
| 203 | + } |
| 204 | + } |
| 205 | + } |
| 206 | + ] |
| 207 | +} |
| 208 | +``` |
| 209 | + |
| 210 | +You can also view storage configurations for other resource types by changing the `--resource-type` parameter to values like `CALL_RECORDINGS`, `SCHEDULED_REPORTS`, or `MEDIA_STREAMS`. |
| 211 | + |
| 212 | +## Set up a phone number |
| 213 | + |
| 214 | +To enable your contact center to receive calls, you need to set up a phone number. |
| 215 | + |
| 216 | +**To search for available phone numbers:** |
| 217 | + |
| 218 | +```bash |
| 219 | +aws connect search-available-phone-numbers \ |
| 220 | + --target-arn arn:aws:connect:us-west-2:123456789012:instance/abcd1234-a123-4567-xmpl-a123b4cd56ef \ |
| 221 | + --phone-number-type TOLL_FREE \ |
| 222 | + --phone-number-country-code US \ |
| 223 | + --max-results 5 |
| 224 | +``` |
| 225 | + |
| 226 | +This command searches for available toll-free phone numbers in the United States. The output includes a list of available phone numbers: |
| 227 | + |
| 228 | +```json |
| 229 | +{ |
| 230 | + "AvailableNumbersList": [ |
| 231 | + { |
| 232 | + "PhoneNumber": "+18005550100", |
| 233 | + "PhoneNumberType": "TOLL_FREE", |
| 234 | + "PhoneNumberCountryCode": "US" |
| 235 | + }, |
| 236 | + ... |
| 237 | + ] |
| 238 | +} |
| 239 | +``` |
| 240 | + |
| 241 | +**To claim a phone number:** |
| 242 | + |
| 243 | +```bash |
| 244 | +aws connect claim-phone-number \ |
| 245 | + --target-arn arn:aws:connect:us-west-2:123456789012:instance/abcd1234-a123-4567-xmpl-a123b4cd56ef \ |
| 246 | + --phone-number +18005550100 |
| 247 | +``` |
| 248 | + |
| 249 | +Replace the phone number with one from the search results. The command returns the claimed phone number's details: |
| 250 | + |
| 251 | +```json |
| 252 | +{ |
| 253 | + "PhoneNumberId": "abcd1234-a123-4567-xmpl-a123b4cd56ef", |
| 254 | + "PhoneNumberArn": "arn:aws:connect:us-west-2:123456789012:phone-number/abcd1234-a123-4567-xmpl-a123b4cd56ef" |
| 255 | +} |
| 256 | +``` |
| 257 | + |
| 258 | +Make note of the `PhoneNumberId` value, as you'll need it to release the phone number later. |
| 259 | + |
| 260 | +## Troubleshooting |
| 261 | + |
| 262 | +**Instance creation fails with "ServiceQuotaExceededException"** |
| 263 | + |
| 264 | +If you receive this error, you've reached the limit for the number of Amazon Connect instances in your account. You can request a quota increase through the Service Quotas console or delete unused instances. |
| 265 | + |
| 266 | +**To check your current Amazon Connect instance quota:** |
| 267 | + |
| 268 | +```bash |
| 269 | +aws service-quotas get-service-quota \ |
| 270 | + --service-code connect \ |
| 271 | + --quota-code L-AA19FD77 |
| 272 | +``` |
| 273 | + |
| 274 | +**To list existing instances:** |
| 275 | + |
| 276 | +```bash |
| 277 | +aws connect list-instances |
| 278 | +``` |
| 279 | + |
| 280 | +**Security profiles not found after instance creation** |
| 281 | + |
| 282 | +If you can't list security profiles immediately after creating an instance, wait a few more minutes for the instance to fully initialize. The instance status may show as ACTIVE before all resources are fully provisioned. |
| 283 | + |
| 284 | +**Phone number claim fails** |
| 285 | + |
| 286 | +If claiming a phone number fails, the number may have been claimed by another user. Try searching for available numbers again and select a different one. |
| 287 | + |
| 288 | +## Going to production |
| 289 | + |
| 290 | +This tutorial demonstrates how to create and configure an Amazon Connect instance using the AWS CLI. For production environments, consider the following best practices: |
| 291 | + |
| 292 | +### Security considerations |
| 293 | + |
| 294 | +1. **Password management**: Store administrator passwords in AWS Secrets Manager instead of using hardcoded values or storing them in log files. |
| 295 | + |
| 296 | + ```bash |
| 297 | + aws secretsmanager create-secret \ |
| 298 | + --name "connect/admin-password" \ |
| 299 | + --secret-string "StrongPassword123!" |
| 300 | + ``` |
| 301 | + |
| 302 | +2. **IAM permissions**: Use the principle of least privilege by creating custom IAM policies instead of using the `AmazonConnect_FullAccess` managed policy. |
| 303 | + |
| 304 | +3. **Resource tagging**: Apply tags to all resources for better organization, cost tracking, and access control. |
| 305 | + |
| 306 | + ```bash |
| 307 | + aws connect tag-resource \ |
| 308 | + --resource-arn arn:aws:connect:us-west-2:123456789012:instance/abcd1234-a123-4567-xmpl-a123b4cd56ef \ |
| 309 | + --tags Environment=Production,Owner=ContactCenterTeam |
| 310 | + ``` |
| 311 | + |
| 312 | +4. **Encryption**: Review and customize the default encryption settings for data storage. |
| 313 | + |
| 314 | +5. **Network security**: Consider using Amazon Connect with AWS PrivateLink to keep traffic within the AWS network. |
| 315 | + |
| 316 | +### Architecture best practices |
| 317 | + |
| 318 | +1. **High availability**: Deploy Amazon Connect in multiple AWS regions for disaster recovery. |
| 319 | + |
| 320 | +2. **Integration with identity providers**: For production environments, consider using SAML 2.0 identity providers instead of CONNECT_MANAGED user management. |
| 321 | + |
| 322 | +3. **Monitoring and logging**: Set up CloudWatch alarms and dashboards to monitor your contact center performance. |
| 323 | + |
| 324 | +4. **Contact flow versioning**: Use a version control system to manage your contact flow configurations. |
| 325 | + |
| 326 | +For more information on production best practices, see: |
| 327 | +- [Amazon Connect Security Best Practices](https://docs.aws.amazon.com/connect/latest/adminguide/security-best-practices.html) |
| 328 | +- [Amazon Connect Architecture Center](https://aws.amazon.com/architecture/connect/) |
| 329 | +- [AWS Well-Architected Framework](https://aws.amazon.com/architecture/well-architected/) |
| 330 | + |
| 331 | +## Clean up resources |
| 332 | + |
| 333 | +When you're done with your Amazon Connect instance, you can clean up the resources to avoid incurring charges. |
| 334 | + |
| 335 | +**To release a claimed phone number:** |
| 336 | + |
| 337 | +```bash |
| 338 | +aws connect release-phone-number \ |
| 339 | + --phone-number-id abcd1234-a123-4567-xmpl-a123b4cd56ef |
| 340 | +``` |
| 341 | + |
| 342 | +**To delete the Amazon Connect instance:** |
| 343 | + |
| 344 | +```bash |
| 345 | +aws connect delete-instance \ |
| 346 | + --instance-id abcd1234-a123-4567-xmpl-a123b4cd56ef |
| 347 | +``` |
| 348 | + |
| 349 | +Deleting the instance will also delete all associated resources, including users, security profiles, and routing profiles. |
| 350 | + |
| 351 | +## Next steps |
| 352 | + |
| 353 | +Now that you've created an Amazon Connect instance, you can explore additional features: |
| 354 | + |
| 355 | +* [Set up contact flows](https://docs.aws.amazon.com/connect/latest/adminguide/contact-flow.html) to define how contacts are handled in your contact center |
| 356 | +* [Configure queues](https://docs.aws.amazon.com/connect/latest/adminguide/create-queue.html) to manage how contacts are distributed to agents |
| 357 | +* [Set up quick connects](https://docs.aws.amazon.com/connect/latest/adminguide/quick-connects.html) to enable agents to transfer contacts to specific destinations |
| 358 | +* [Enable contact recording](https://docs.aws.amazon.com/connect/latest/adminguide/set-up-recordings.html) to record customer interactions for quality assurance |
| 359 | +* [Integrate with Amazon Lex](https://docs.aws.amazon.com/connect/latest/adminguide/amazon-lex.html) to add chatbots to your contact center |
| 360 | +* [Set up real-time and historical metrics](https://docs.aws.amazon.com/connect/latest/adminguide/real-time-metrics-reports.html) to monitor your contact center performance |
0 commit comments