Introduction to AWS
Amazon Web Services (AWS) is a comprehensive cloud computing platform provided by Amazon. It offers a wide array of services, including computing power, storage options, and networking capabilities, making it a popular choice for businesses and individuals alike. For beginners, AWS provides a Free Tier, which allows access to many of its services with certain usage limits for a year. This Free Tier is a great way to get hands-on experience without incurring significant costs.
Learning by Doing: My Approach
As a recent graduate from Simon Fraser University, I found the best way to learn AWS was through practical experience. Instead of diving straight into theoretical knowledge, I decided to embark on a project that would allow me to explore AWS services within the Free Tier limits. This approach not only solidified my understanding but also provided me with a tangible outcome to showcase my skills.
AWS Free Tier Limits
The AWS Free Tier includes two main components: always free and free for a limited time. My application utilizes both. Here’s a breakdown of these limits:
- Lambda: Always free tier includes 1,000,000 requests per month.
- API Gateway: Free for 12 months, allowing up to 1,000,000 HTTP requests per month.
- S3: Free for 12 months, including 5 GB of standard storage, 2,000 PUT requests, and 20,000 GET requests per month.
- CloudFront: Always free tier includes 1,000,000 requests per month.
- DynamoDB: Always free tier includes 25 GB of storage and 25 provisioned write and read capacity units per month.
- Cognito: Always free tier includes up to 50,000 monthly active users (MAUs).
- SES: Free for 12 months, allowing 3,000 outbound or inbound emails per month.
- CloudWatch: Always free tier includes 10 custom alarms and 1,000,000 requests per month for monitoring services, including billing alerts.
This summary outlines the free usage limits provided by AWS, and what I leveraged for my application.
Building a Website with AWS
To start, I needed to build a static website while staying within the Free Tier limits. Here’s how I achieved that:
AWS Services Used for Static Web Hosting
- AWS S3: I used an S3 bucket to host my static website. S3 is perfect for this purpose as it allows you to store and retrieve any amount of data at any time. It’s also very cost-effective, especially within the Free Tier limits.
- AWS CloudFront: To point the S3 bucket to my domain (LetterForge.code4u.app) and to save money by reducing the number of GET requests to the S3 bucket, I set up a CloudFront distribution. This also improved the website’s performance by caching content closer to users.
Implementing Website Features
To add more features to my website, I needed to store data, manage resources, automate content creation, and handle user accounts and email communication. Here are the AWS services I used:
- DynamoDB: This NoSQL database service stored and accessed the necessary information for my website efficiently.
- Lambda: Lambda functions managed various resources based on triggers from CloudWatch or API Gateway. This serverless computing service allowed me to run code without provisioning or managing servers.
- CloudWatch: CloudWatch monitored my billing to ensure I didn’t exceed Free Tier limits significantly. It also set daily triggers for a Lambda function that generated new data for my website.
- API Gateway: API Gateway enabled the website to interact with AWS services through HTTPS calls.
- Cognito: Cognito handled user creation, and provided secure user tokens.
- SES: Simple Email Service (SES) sent verification codes and password reset emails to users.
- IAM: Identity and Access Management (IAM) allowed me to create policies and roles to restrict what my Lambda functions could do, ensuring the website’s security.
Overcoming Challenges
Learning AWS came with its share of challenges, which I’d like to share to help others avoid similar pitfalls.
Lambda Function Configuration
One of the biggest challenges was making Lambda functions work properly and setting up the triggers correctly. Understanding policies and configuring CORS (Cross-Origin Resource Sharing) for API calls were particularly tricky. Ensuring that CORS was enabled for both the CloudFront distribution and the S3 bucket was essential to avoid issues with Lambda functions.
DNS Configuration
Configuring the DNS for my domain (code4u.app) for both CloudFront and SES was another hurdle. Not all DNS services include the domain automatically when setting up records. In my case, I had to adjust CNAME record values by removing the ending trail of code4u.app or adding a period at the end. It’s crucial to carefully check if your DNS service automatically includes the domain in the records for the host.
Importance of Policies
Setting up the right policies for Lambda functions is vital. You don’t want your functions to have full access to all your services. Carefully checking what each Lambda function needs to access ensures your website remains secure.
Conclusion
Embarking on this journey to learn AWS has been both challenging and rewarding. By building a project from scratch, I gained practical experience with various AWS services and learned how to overcome common obstacles. I hope sharing my experience helps others in their own AWS learning journey. Remember, learning by doing is the best way to master AWS, so don’t be afraid to dive in and start building!
Check out the Project at LetterForge