0
0
PowerShellscripting~20 mins

AWS PowerShell module - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
AWS PowerShell Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
Understanding AWS PowerShell Module Cmdlet Behavior

What will be the output of the following PowerShell command using AWS Tools for PowerShell?

Get-EC2Instance -InstanceIds 'i-1234567890abcdef0' | Select-Object -ExpandProperty Instances | Select-Object InstanceId, State
PowerShell
Get-EC2Instance -InstanceIds 'i-1234567890abcdef0' | Select-Object -ExpandProperty Instances | Select-Object InstanceId, State
AA list of objects showing InstanceId and State properties for the specified instance.
BAn error indicating that 'Instances' property does not exist on the output object.
CNo output because the command silently fails due to missing credentials.
DA list of all EC2 instances in the account ignoring the specified InstanceIds parameter.
Attempts:
2 left
💡 Hint

Consider what the -ExpandProperty parameter does in PowerShell and how AWS cmdlets return data.

Configuration
intermediate
2:00remaining
Configuring AWS Credentials in PowerShell

Which of the following commands correctly sets AWS credentials for the current PowerShell session using AWS Tools for PowerShell?

AInitialize-AWSDefaultConfiguration -AccessKey 'AKIA...' -SecretKey 'secret'
BSet-AWSDefaultCredential -AccessKey 'AKIA...' -SecretKey 'secret'
CSet-AWSCredential -AccessKey 'AKIA...' -SecretKey 'secret' -StoreAs 'MyProfile'
DNew-AWSCredential -AccessKey 'AKIA...' -SecretKey 'secret' -ProfileName 'MyProfile'
Attempts:
2 left
💡 Hint

Look for the cmdlet that explicitly sets credentials and optionally stores them under a profile name.

Architecture
advanced
3:00remaining
Designing a PowerShell Script for AWS Resource Cleanup

You want to write a PowerShell script using AWS Tools for PowerShell to delete all EC2 instances with a specific tag key-value pair. Which approach below correctly lists and deletes only those instances?

AUse <code>Get-EC2Instance</code> with <code>-Filter @{Name='tag:Key'; Values='Value'}</code> to get instances, then pipe to <code>Remove-EC2Instance</code> with <code>-InstanceId</code> parameter.
BUse <code>Get-EC2Instance</code> without filters, then filter instances in PowerShell by tag, then call <code>Remove-EC2Instance</code> with instance IDs.
CUse <code>Get-EC2Instance</code> with <code>-InstanceIds</code> parameter set to tag values, then delete instances.
DUse <code>Remove-EC2Instance</code> with <code>-Filter @{Name='tag:Key'; Values='Value'}</code> directly to delete instances.
Attempts:
2 left
💡 Hint

Think about how AWS cmdlets accept filters and how deletion cmdlets require instance IDs.

security
advanced
2:00remaining
Handling AWS Credentials Securely in PowerShell Scripts

Which practice below is the most secure way to handle AWS credentials in PowerShell scripts for automation?

APrompt the user to enter credentials interactively every time the script runs.
BHardcode AWS Access Key and Secret Key directly in the script variables.
CStore credentials in plain text files and read them in the script at runtime.
DUse IAM roles attached to the compute environment and avoid embedding credentials in scripts.
Attempts:
2 left
💡 Hint

Consider AWS best practices for credential management in automated environments.

🧠 Conceptual
expert
3:00remaining
Understanding AWS PowerShell Module Credential Resolution Order

In what order does the AWS Tools for PowerShell module resolve credentials when executing a cmdlet?

AIAM role &gt; Shared credentials file &gt; Environment variables &gt; Explicit credentials passed to the cmdlet
BExplicit credentials passed to the cmdlet &gt; Environment variables &gt; Shared credentials file &gt; IAM role
CShared credentials file &gt; Explicit credentials passed to the cmdlet &gt; IAM role &gt; Environment variables
DEnvironment variables &gt; IAM role &gt; Explicit credentials passed to the cmdlet &gt; Shared credentials file
Attempts:
2 left
💡 Hint

Think about the precedence of credentials explicitly provided versus environment or role-based credentials.