如何使用CloudFormation添加UserPool的资源服务器?

时间:2018-07-13 02:03:32

标签: amazon-web-services amazon-cloudformation amazon-cognito

使用CloudFormation,如何在AWS Cognito中为UserPool创建资源服务器?

在CloudFormation文档中,Cognito下只有5个项目,我看不到如何配置ResourceServer,这有可能吗?

谢谢。

3 个答案:

答案 0 :(得分:1)

CloudFormation不支持资源服务器以及其他项。这是所有supported resources的列表。

作为CloudFormation的替代方法,您可以使用CLI or SDK to provision and manage a Resource Server。使用SDK,您可以在CloudFormation中创建Lambda-Backed Customer Resource。然后,您可以在CloudFormation中将资源服务器添加为自定义资源。

答案 1 :(得分:1)

现在可以直接在AWS::Cognito::UserPoolResourceServer资源类型的cloudformation上使用。您无需创建自定义资源即可创建资源服务器。现在,它由cloudformation支持。参见https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolresourceserver.html 我尝试将自定义资源更新为cloudformation的资源,但是由于某种原因,资源服务器不可更新。因此,首先我必须删除一个变更集中的自定义资源,然后重新创建为AWS::Cognito::UserPoolResourceServer

答案 2 :(得分:0)

您可以使用this通用自定义资源提供程序。

像这样使用它(未经测试,但应该可以正常工作):

SELECT 'Organization' [Party, Record Type]
    ,VEN.NAME [Party, Name]
    ,VEN.NAMEALIAS [Search Name]
    ,VEN.LANGUAGEID [Party, Language]
    ,VEN.NAME [Party Address, Name]
    ,CASE [ADD1].TYPE WHEN 0 THEN ''
                WHEN 1   THEN 'Invoice'
                WHEN 2   THEN 'Delivery'
                WHEN 3   THEN 'Alt. Delivery'
                WHEN 4   THEN 'SWIFT'
                WHEN 5   THEN 'Payment'
                WHEN 6   THEN 'Service'
                WHEN 7   THEN 'Home'
                WHEN 8   THEN 'Other'
                WHEN 9   THEN 'Business'
                WHEN 10  THEN 'Remit-To'
                WHEN 11  THEN 'Third-party Shipping Address'
                WHEN 100 THEN 'Remit-To'
        END AS [Party Address, Purpose]
    ,[ADD1].COUNTRYREGIONID [Party Address, Country/Region]
    ,[ADD1].ZIPCODE [Party Address, SIP/postal code]
    ,[ADD1].STREET [Party Address, Street]
    ,[ADD1].CITY [Party Address, City]
    ,[ADD1].[STATE] [Party Address, State]
    ,CASE WHEN CON.NAME IS NULL THEN NULL ELSE CON.NAME END AS [Party Contact, Description]
    ,'Phone' [Party Contact, Type]
    ,VEN.PHONE [Party Contact, Locator]
    ,'' [Party Contact, Is Primary]
    ,VEN.ACCOUNTNUM [AccountNum]
    ,VEN.VENDGROUP [VendGroup]
    ,VEN.PAYMMODE [PaymMode]
    ,VEN.PAYMTERMID [Paym Term Id]
    ,VEN.CASHDISC [CashDisc]
    ,VEN.DLVMODE [Deliver Mode]
    ,VEN.DLVTERM [DlvTerm]
    ,VEN.W9 [W9]
    ,VEN.TAX1099REPORTS [Tax 1099 Report]
    ,VEN.TAX1099BOX [Tax 1099 Box]
    ,'' [Tax 1099 Name Choice]
    ,VEN.DBA [DBA]
    ,VEN.TAX1099REGNUM [Tax 1099 Reg Num]
    ,VEN.INVENTSITEID [Invent SiteId]
    ,VEN.INVENTLOCATION [Invent Location]
    ,VEN.TAXGROUP [Sales Tax Group]
    ,[ADD].NAME [Party Address, Name]
    ,CASE [ADD].TYPE WHEN 0 THEN ''
                WHEN 1   THEN 'Invoice'
                WHEN 2   THEN 'Delivery'
                WHEN 3   THEN 'Alt. Delivery'
                WHEN 4   THEN 'SWIFT'
                WHEN 5   THEN 'Payment'
                WHEN 6   THEN 'Service'
                WHEN 7   THEN 'Home'
                WHEN 8   THEN 'Other'
                WHEN 9   THEN 'Business'
                WHEN 10  THEN 'Remit-To'
                WHEN 11  THEN 'Third-party Shipping Address'
                WHEN 100 THEN 'Remit-To'
        END AS [Party Address, Purpose]
    , [ADD].COUNTRYREGIONID [Party Address, Country/Region]
    , [ADD].ZIPCODE [Party Address, ZIP/Postal code]
    , [ADD].STREET [Party Address, Street]
    , [ADD].CITY [Party Address, City]
    , [ADD].[STATE] [Party Address, State]
FROM VENDTABLE VEN
LEFT JOIN DIRPARTYTABLE DIR ON DIR.PARTYID = VEN.PARTYID
LEFT JOIN ADDRESS [ADD] ON [ADD].ADDRRECID = DIR.RECID AND [ADD].ADDRTABLEID = 2303
    AND [ADD].STREET <> VEN.STREET
LEFT JOIN ADDRESS [ADD1] ON [ADD1].ADDRRECID = DIR.RECID AND [ADD1].ADDRTABLEID = 2303
    AND [ADD1].STREET = VEN.STREET
LEFT JOIN CONTACTPERSON CON ON CON.VENDACCOUNT = VEN.ACCOUNTNUM
WHERE VEN.CREATEDDATETIME > '2018-04-30'
ORDER BY VEN.ACCOUNTNUM
  

API reference