Giter Site home page Giter Site logo

amazon-connect-migration-utilities's Introduction

Amazon Connect Migration Utilities

Purpose

This project contains an AWS CloudFormation custom resource that manages Amazon Connect contact flows. and a Python script that exports existing contact flows from Connect into a CloudFormation template that references the custom resource.

Requirements

CFNCreateContactFlow Custom Resource

CloudFormation does not natively support creating an Amazon Connect contact flow. CFNCreateContactFlow is a custom resource that enables you to create and update contact flows using CloudFormation.

Connect does not support deleting contact flows.

CFNLambdaConnectPermission Custom Resource

CloudFormation does not natively support attaching a Lambda to Amazon Connect. CFNLambdaConnectPermission is a custom resource that enables you to use CloudFormation to attach a Lambda to a Connect instance.

Connect does not support deleting contact flows.

Deploying the custom resources

From the command line, run the following commands. This will deploy an AWS Lambda custom resource that can be called by your CloudFormation template.

sam build -t cfn-contact-flow-custom-resources .yml
sam deploy  --template-file .aws-sam/build/template.yaml --stack-name cfn-contact-flow-custom-resources   --capabilities "CAPABILITY_NAMED_IAM" --resolve-s3

Using the CFNCreateContactFlow custom resource

AWSTemplateFormatVersion: '2010-09-09'
Description: Connect Contact Flows
Resources:
  sample:
    Type: Custom::ConnectContactFlow
    Properties:
      ServiceToken: !ImportValue: CFNCreateContactFlow
      Description: A sample contact flow
      Content: '{stringified JSON content}'
      Type: CONTACT_FLOW
      Tags: {}
      InstanceId:
        Ref: ConnectInstanceID
      Name: sample

Note: The custom resource supports the contact flow format returned from the describe-contact-flow AWS CLI or the various SDK's. This format is different from the one that is exported from the web console.

You can use the script described below to export a CloudFormation template from an existing Connect Instance.

Contact Flow Exporter script

If you have items in a source Connect instance that you want to import into a destination Connect Instance, you can use the create-contact-flow-template Python script.

Usage

First create a config.json file in the create contact flow directory:

{
    "Input":{
        "ConnectInstanceId":"<Your connect instance ID>"
    },
    "ResourceFilters":
    {
        "ContactFlows":["test1","test2"] 
    },
    "Output":{
        "Filename": "contact-flows.json",
        "TemplateDescription":"Connect Contact Flows"
    }
}
  • ConnectInstanceId -- the ID of the Connect instance containing your contact flows
  • ContactFlows - The exporter will export any published contact flows where the name contains one of the listed words
  • Filename - The name of the output CloudFormation template.
  • TemplateDescription - Describes the purpose of the stack.

Then run the script:

cd create-contact-flow    
pip3 install -r requirements.txt #First time only
python3 create-contact-flow-template.py

Once you run the script, a CloudFormation template will be created.

The template requires one parameter, ConnectInstanceId, which should be the instance where you want to create your contact flows.

Features

  • Replaces the source account number with the ${AWS::AccountId}
  • Replaces the source Connect Instance Id with ${ConnectInstanceID}
  • Replaces references in TransferToFlow to the correct destination references

Using the CFNConnectAssociateLambda custom resource

CFNConnectAssociateLambda is a custom resource used to associate a Lambda to a Connect instance.

  GetContactLambdaPermission:
    Type: Custom::ConnecctAssociateLambda
    Properties:
      InstanceId: !Ref ConnectInstanceID
      FunctionArn: !GetAtt SampleLambda.Arn 
      ServiceToken: !ImportValue CFNConnectAssociateLambda

Security

See CONTRIBUTING for more information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.