0
0
AWScloud~10 mins

Cognito for user authentication in AWS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a new Cognito User Pool with a name.

AWS
resource "aws_cognito_user_pool" "[1]" {
  name = "MyUserPool"
}
Drag options to blanks, or click blank then click option'
Apool1
Buserpool
Cmy_user_pool
Dcognito_pool
Attempts:
3 left
💡 Hint
Common Mistakes
Using spaces or invalid characters in the resource name.
Using a name that is too generic or unclear.
2fill in blank
medium

Complete the code to enable email as a sign-in alias in the Cognito User Pool.

AWS
resource "aws_cognito_user_pool" "my_user_pool" {
  name = "MyUserPool"
  [1] = ["email"]
}
Drag options to blanks, or click blank then click option'
Ausername_attributes
Balias_attributes
Csign_in_aliases
Dlogin_attributes
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'username_attributes' which configures username requirements instead of aliases.
Using 'sign_in_aliases' which is not recognized by AWS Cognito.
3fill in blank
hard

Fix the error in the code to set password policy minimum length to 8.

AWS
resource "aws_cognito_user_pool" "my_user_pool" {
  name = "MyUserPool"
  password_policy {
    minimum_length = [1]
  }
}
Drag options to blanks, or click blank then click option'
Aminimum_length
B"8"
Ceight
D8
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the number inside quotes, making it a string.
Using a word instead of a number.
4fill in blank
hard

Fill both blanks to configure MFA to be optional and enable SMS as a second factor.

AWS
resource "aws_cognito_user_pool" "my_user_pool" {
  name = "MyUserPool"
  mfa_configuration = "[1]"
  sms_configuration {
    [2] = "arn:aws:iam::123456789012:role/SMSRole"
  }
}
Drag options to blanks, or click blank then click option'
AOPTIONAL
BREQUIRED
Csns_caller_arn
Dsms_role_arn
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'REQUIRED' when the task asks for optional MFA.
Using 'sms_role_arn' which is not the correct key.
5fill in blank
hard

Fill all three blanks to create a user pool client with no secret and enable refresh token validity for 30 days.

AWS
resource "aws_cognito_user_pool_client" "my_user_pool_client" {
  name         = "MyUserPoolClient"
  user_pool_id = aws_cognito_user_pool.my_user_pool.id
  [1] = false
  refresh_token_validity = [2]
  token_validity_units {
    refresh_token = "[3]"
  }
}
Drag options to blanks, or click blank then click option'
Agenerate_secret
B30
Cdays
Dsecret_enabled
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'secret_enabled' which is not a valid attribute.
Setting refresh_token_validity as a string instead of a number.
Using 'day' instead of 'days' for the unit.