0
0
Microservicessystem_design~10 mins

Secrets management (Vault, AWS Secrets Manager) in Microservices - Interactive Code Practice

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

Complete the code to retrieve a secret value from AWS Secrets Manager using the AWS SDK.

Microservices
secret_value = client.get_secret_value(SecretId=[1])['SecretString']
Drag options to blanks, or click blank then click option'
Amy_secret_id
B"my-secret-id"
Csecret_id
DsecretId
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the secret id without quotes causes a NameError.
Using incorrect parameter names like 'secretId' instead of 'SecretId'.
2fill in blank
medium

Complete the code to authenticate with Vault using a token.

Microservices
client.token = [1]
Drag options to blanks, or click blank then click option'
Avault_token
Btoken
C"vault_token"
DvaultToken
Attempts:
3 left
💡 Hint
Common Mistakes
Assigning a variable name without quotes instead of the token string.
Using incorrect property names like 'vaultToken'.
3fill in blank
hard

Fix the error in the code to read a secret from Vault's key-value store.

Microservices
secret = client.secrets.kv.v2.read_secret_version(path=[1])['data']['data']
Drag options to blanks, or click blank then click option'
AsecretPath
Bpath
Csecret_path
D"secret_path"
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the path without quotes causes a NameError.
Using incorrect parameter names like 'secretPath'.
4fill in blank
hard

Fill both blanks to configure AWS Secrets Manager client with region and version.

Microservices
client = boto3.client('secretsmanager', region_name=[1], api_version=[2])
Drag options to blanks, or click blank then click option'
A"us-west-2"
B"2017-10-17"
C"us-east-1"
D"latest"
Attempts:
3 left
💡 Hint
Common Mistakes
Using invalid region names or API versions.
Forgetting to quote the string values.
5fill in blank
hard

Fill both blanks to store a secret in Vault with a key and value.

Microservices
client.secrets.kv.v2.create_or_update_secret(path=[1], secret=[2])
Drag options to blanks, or click blank then click option'
A"app/config"
B{"password": "s3cr3t"}
C{"username": "admin"}
D"config/app"
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the secret as a string instead of a dictionary.
Using incorrect path strings.