Boto3 Practice Tasks
BEGINNER
1. Install and Configure Boto3:
- Install Boto3 and configure AWS credentials using `aws configure`.
- Write a script that initializes a Boto3 session and prints available services.
2. List S3 Buckets:
- Use Boto3 to connect to S3 and list all your buckets.
- Print each bucket name and creation date.
3. Create an S3 Bucket and Upload a File:
- Write a script to create a new S3 bucket.
- Upload a text file from your local machine to the bucket.
4. List EC2 Instances:
- Use Boto3 to list all EC2 instances in a region.
- Print instance IDs and state information.
5. Generate a Pre-Signed URL for S3:
- Create a pre-signed URL for an object in your S3 bucket.
- Test the URL in your browser to verify access.
INTERMEDIATE
6. Launch and Manage an EC2 Instance:
- Write a script to launch a new EC2 instance with a specific instance type and
AMI.
- Wait until the instance is running, then stop and terminate it.
7. Create and Query a DynamoDB Table:
- Use Boto3 to create a DynamoDB table with partition and sort keys.
- Write a script to insert an item and retrieve it by querying.
8. Use SSM to Store and Retrieve Secrets:
- Store a secret value in AWS Systems Manager Parameter Store.
- Retrieve the value using Boto3 and log it securely.
9. Create a Lambda Function:
- Use Boto3 to create a new Lambda function and upload code.
- Invoke the function with sample data and check logs in CloudWatch.
10. Set Up CloudWatch Alarms:
- Create a CloudWatch alarm that monitors an EC2 instance’s CPU usage.
- Set up an alarm action to notify you when the threshold is reached.
ADVANCED
11. Manage IAM Policies and Roles:
- Write a script to create a new IAM role and attach a policy to allow S3
access.
- List all policies attached to the role.
12. Launch an RDS Instance:
- Use Boto3 to create an Amazon RDS database instance.
- Wait for the instance to be available and then connect using credentials.
13. Automate a Snapshot Backup for EC2:
- Write a script that creates a snapshot of an EBS volume attached to an EC2
instance.
- Verify that the snapshot appears in the console.
14. Integrate SQS and SNS:
- Create an SNS topic and subscribe an email endpoint.
- Send messages from an SQS queue to the SNS topic.
15. Automate a Lambda Deployment Pipeline:
- Create a CI/CD pipeline using CodePipeline and CodeBuild.
- Use Boto3 to programmatically set up the pipeline to deploy a Lambda function
automatically on changes.