Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a new AWS account using AWS Organizations.
AWS
response = client.create_account(AccountName=[1], Email='user@example.com')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to put quotes around the account name.
✗ Incorrect
You must provide the account name as a string in quotes.
2fill in blank
mediumComplete the code to list all AWS accounts in your organization.
AWS
accounts = client.list_accounts()[1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using dot notation instead of .get() for dictionary keys.
✗ Incorrect
The list_accounts() method returns a dictionary. Use .get('Accounts') to access the accounts list.
3fill in blank
hardFix the error in the code to attach a policy to an AWS account.
AWS
client.attach_policy(PolicyId=[1], TargetId='123456789012')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using an unquoted variable or number for PolicyId.
✗ Incorrect
PolicyId must be a string with quotes, like 'p-abcdefg123'.
4fill in blank
hardFill both blanks to create a new organizational unit (OU) under a root.
AWS
response = client.create_organizational_unit(ParentId=[1], Name=[2])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving out quotes around string parameters.
✗ Incorrect
ParentId and Name must be strings with quotes.
5fill in blank
hardFill the blanks to tag an AWS account with a key and value.
AWS
client.tag_resource(ResourceId=[1], Tags=[[2]])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ARN instead of account ID for ResourceId.
Not formatting Tags as a list of dicts.
✗ Incorrect
ResourceId is the account ID as a string. Tags is a list of dictionaries with Key and Value.