Cloud Bootcamp: Cloud Project
You cant leave out learning more about a cloud provider when learning cloud engineering. I stuck with AWS since it is what I know best. Cloud computing is the future is it best to learn it now. More and more companies will be adopting cloud infrastructure. -
What is cloud computing? Cloud computing is the on-demand delivery of IT resources over the Internet with pay-as-you-go pricing. Instead of buying, owning, and maintaining physical data centers and servers, you can access technology services, such as computing power, storage, and databases, on an as-needed basis
- What are the big 3 cloud providers? Amazon Web Services (AWS), Microsoft Azure, and Google Cloud Platform (GCP)
Serverless Sending Application:
Manage email and SMS sendings using Step Functions;
Create and send an email with AWS using SES and Lambda;
Lambda: AWS Lambda is a serverless, event-driven compute service that lets you run code for virtually any type of application or backend service without provisioning or managing servers. You can trigger Lambda from over 200 AWS services and software as a service (SaaS) applications, and only pay for what you use. Lambda's strength lies in its ability to interact with other AWS services. It is possible to make instructions such as "send the received data to SQS" or "change the format of an image uploaded to S3" using Lambda. In order for a Lambda function to interact with a service, the function must have what is called a Lambda Role. The Lambda Role contains the permissions of our Lambda function, such as the permission to use all actions of the SNS service for example.
To interact with AWS services like SES, SNS, and Step Functions, a Lambda Role needs to be created with execution rights for these services. Here is a summary of the steps to create the Lambda Role
Go to the IAM (Identity and Access Management) console and select "Roles".
Click on "Create Role" to start creating a new role.
Choose "AWS Service" as the trusted entity type and select "Lambda" as the use case.
Add permissions to the role by searching for the service names (SES, SNS, and Step Functions) and selecting "Full Access" to grant all necessary permissions.
Note: It is recommended to refine the permissions by specifying only the necessary rights for the actions you intend to perform with the services.
Validate and create the Lambda Role with a desired name.
Once the Lambda Role is created, you can proceed to create the first Lambda function, "email.py".
SES- an email platform that provides an easy, cost-effective way for you to send and receive email using your own email addresses and domains
Before using SES, ensure that the sender's and recipient's email addresses are verified in SES.
Create a Lambda function called "email" using Python 3.9.
Import the boto3 library to interact with AWS services.
Initialize the SES client using boto3.client('ses').
Define the lambda_handler function, which receives the event and context arguments.
Use the SES send_email function to send an email. Specify the source, destination, and message fields.
Retrieve the destination email address and message from the event argument instead of hard-coding them.
Add a return statement at the end of the function.
Deploy and test the Lambda function by configuring a test event with the destination email address and message.
Verify that the email is successfully sent and received.
Step function- a visual workflow service that helps developers use AWS services to build distributed applications, automate processes, orchestrate microservices, and create data and machine learning (ML) pipelines
I couldn’t verify my phone number so I was unable to get SMS to work.
Step Functions is a low-code, visual workflow service provided by AWS. It allows developers to build distributed applications, automate IT and business processes, and create data and machine learning pipelines using AWS services. To manage how to send messages using Step Functions, follow these steps:
Access the Step Functions console and select "State machines".
Click on "Create state machine".
Choose the option to "Write your workflow in code".
Select the "Standard" type for the state machine, as it is eligible for the Free Tier.
Define the state machine using JSON code.
Start by adding a comment explaining the functionality of the state machine.
Set the starting point of the state machine using the "StartAt" field.
Create states for handling different types of sending, such as email or SMS.
Use the "Choice" type state to select the appropriate action based on the value of the "typeOfSending" variable.
Define the "Email" and "SMS" states as "Task" types, specifying the ARNs of the corresponding Lambda functions.
Mark the "Email" and "SMS" states as the end states.
Add the ARNs of the Lambda functions to the corresponding states.
Provide a name for the state machine and create it.
Start an execution of the state machine by providing a test input with the required variables.
Verify the successful execution of the state machine by checking the generated workflow graph and confirming the message delivery.
With the completion of the state machine, you can proceed to the next step, which is creating the REST API handler using Lambda.
This resource was very helpful. https://tutorialsdojo.com/aws-cheat-sheets/