Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws_cognito: configure SnsRegion for SMS messages #19434

Closed
mstfldmr opened this issue Mar 17, 2022 · 2 comments · Fixed by #19519
Closed

aws_cognito: configure SnsRegion for SMS messages #19434

mstfldmr opened this issue Mar 17, 2022 · 2 comments · Fixed by #19519
Assignees
Labels
effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md p2

Comments

@mstfldmr
Copy link

mstfldmr commented Mar 17, 2022

General Issue

aws_cognito.UserPool doesn't have an option to configure SMS

The Question

According to https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html
AWS::Cognito::UserPool has a parameter SmsConfiguration. But it is not available in aws_cognito.UserPool https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_cognito/UserPool.html

Moreover, although I create the user pool in Frankfurt region, the user pool is by default trying to send MFA messages through SNS in Ireland region.

CDK CLI Version

2.15.0

Framework Version

No response

Node.js Version

No response

OS

No response

Language

Python

Language Version

No response

Other information

No response

@mstfldmr mstfldmr added guidance Question that needs advice or information. needs-triage This issue or PR still needs to be triaged. labels Mar 17, 2022
@mstfldmr mstfldmr changed the title (module name): short issue description aws_cognito: UserPool doesn't have an option to configure SMS Mar 17, 2022
@peterwoodworth
Copy link
Contributor

The UserPool construct will put together the configuration for you - see our Readme for details, or if you're curious, our source code

Moreover, although I create the user pool in Frankfurt region, the user pool is by default trying to send MFA messages through SNS in Ireland region

According to Cognito docs, this is normal

At launch, for some AWS Regions, Amazon Cognito sent SMS messages with Amazon SNS resources in an alternate Region. To set your preferred Region, use the SnsRegion parameter of the SmsConfigurationType object for your user pool. When you programmatically create an Amazon Cognito user pools resource in an Amazon Cognito Region from the following table and you do not provide an SnsRegion parameter, your user pool sends SMS messages with Amazon SNS resources in the corresponding Legacy Amazon SNS alternate Region

This is the part that the CDK doesn't directly support - since the SnsConfiguration method doesn't ever return an SnsRegion property.

However, you can add overrides to the template the CDK synthesizes. You'll be able to access the underlying CfnUserPool and use escape hatches to add and set the SnsRegion property to your desired region

Relabelling as a feature request for SnsConfiguration method to support setting SnsRegion directly

@peterwoodworth peterwoodworth added p2 feature-request A feature should be added or improved. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md and removed guidance Question that needs advice or information. needs-triage This issue or PR still needs to be triaged. labels Mar 22, 2022
@peterwoodworth peterwoodworth changed the title aws_cognito: UserPool doesn't have an option to configure SMS aws_cognito: configure SnsRegion for SMS messages Mar 22, 2022
@mergify mergify bot closed this as completed in #19519 Mar 28, 2022
mergify bot pushed a commit that referenced this issue Mar 28, 2022
fixes #19434 

updated integ test domain value, because old value was [failing deployment](aws-samples/aws-cdk-examples#402)

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)?
	* [x] Did you use `cdk-integ` to deploy the infrastructure and generate the snapshot (i.e. `cdk-integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

StevePotter pushed a commit to StevePotter/aws-cdk that referenced this issue Apr 27, 2022
)

fixes aws#19434 

updated integ test domain value, because old value was [failing deployment](aws-samples/aws-cdk-examples#402)

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)?
	* [x] Did you use `cdk-integ` to deploy the infrastructure and generate the snapshot (i.e. `cdk-integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants