CC Practical New
CC Practical New
Practical 1
Step-12: It will create a blank lambda function and also give a url using which lambda function
can be invoked.
Step-13: In the code part you can write code in python as runtime is python.
Step-14: Event will contain all user specified events which are passed while invoking lambda
function.
Step-15: In python it will follow flask framework format to execute code.
Step-16: Code will return status code and response body.
Step-17: Click on deploy and it will publish the lambda function.
Step-18: You can click on the function URL to execute the function.
Step-19: Modify code and add an event inside the body to see all received events.
Step-20: Now modify code to print greetings to users so that you can get
‘queryStringparameters’ from events and then get required parameters.
Step-21: Use(“hello {} {}”.format(first_name,last_name) to print hello `first_name` and
`last_name`).
Step-22: Code
Import json
Def lambda_handler(event, context):
first_name=event[‘queryStringParameters’][‘first_name’
]
last_name=event[‘queryStringParameters’][‘last_name’]
Return {
‘statusCode’: 200,
‘body’: json.dumps(“hello {} {}” .format(first_name,last_name))
}
Practical 2
Aim: Building a web application. Students can build a simple web application
using Platform as a Service (PaaS) provider and deploy it to the cloud.
Step-4: Click next to add permission. From that select following permission:
● AWSElasticBeanstalkWebTier
● AWSElasticBeanstalkWorkerTier
● AWSElasticBeanstalkMulticontainerDocker
PRACTICAL-3
Overview: AnyCompany Ice Cream would like you to create a static website
which displays their ice cream flavors. We will configure and use S3 bucket to
deploy our static website.
Step-1: Login to AWS Builder Lab & Download the Zip file.
Step-3: There are already two buckets are available click on Second Lab Stack Bucket
OverView: In this task, verify if the new dynamic website is working and that data
about the inventory for available ice cream Flavors is returned from the database.
Step-3: Copy the Public IPv4 Address & paste on the browser.
Overview: In this task, we will create a new ice cream flavor in the Products
table using the Amazon DynamoDB console.
Step-2: Already one table is available & click on the produce table.
Step-6: Add new attributes & values then click on create items.
Practical-4
Overview: In this practical, we will learn about how we can create a data stream
using Amazon Kinesis
Step-2: Select Kinesis Data Streams & Click to create data stream.
Overview: In this task, you will define an AWS Lambda function that will be
triggered by data coming into the stream.
Step-1: Search for Lambda.
Step-9: In the Kinesis trigger section Select Kinesis Stream (Which We have created earlier) &
Create Function.
Overview: In this task, you will create a DynamoDB table that contains scores for
online games.
Step-5: Create another table name GameScoreByUser & five Partition Key Username(String).
Overview: In this task, you will create a Lambda function that will be triggered by
updates to your DynamoDb table.
Step-10: In the code part change the index.js code & deploy.
Step-20: Already we have created two tables: select GameScoreRecords and Click on Explore
Items.
Practical 5
Overview: In this task, you will use CRA to generate the React development
environment for your EC2 Vendor app. You will also start a local debugging
session to preview your running app.
(B) : Update the React app to use traditional HTML elements for the EC2
Vendor app.
Overview: In this task, you will remove the CRA-created content and use standard
HTML elements to build an outline of your app.
(E) : Update the app to include effects, props and a reusable component.
Overview: In this task, you will update your app with the ability to dynamically
add and remove instances.
(F) : Create an Amplify app using the CLI and add authentication services.
Overview: In this task, you will install the Amplify CLI, create an Amplify app
with an AWS Identity and Access Management (IAM) permissions boundary,
and add authentication services based on Amazon Cognito.
Step-1: npm install -g @aws-amplify/cli
(H) : Create an AWS Lambda function which takes input from an API and
interacts with the EC2 service using the AWS SDK .
Overview: In this task, you use Amplify to create a Node.js Lambda function
that takes input from an API and interacts with the EC2 service using the AWS
SDK. This includes getting Amazon Machine Image (AMI) data, querying,
starting and terminating EC2 instances.
Step-1: cd ~/environment/ec2-vendor
Step-2: amplify add function.
Step-3: capability you want to add: Lambda function (serverless function).
Step-4: lambda function name: ec2VendorApi.
Step-5: runtime NodeJS.
Step-6: function template: Hello World. Step-7: Configure Advanced Setting: No. Step-8: Edit
the local Lambda function:
Step-1: cd ~/environment/ec2-vendor.
Step-2: amplify add api.
Step-3: Select REST service.
Step-4: Give label name vendorApi for project.
Step-5: Provide Path : /vendor.
Step-6: Lambda source: Use a Lambda function already added in the current Amplify project.
Step-7: Restrict API access? YES.
Step-8: Who should have access? Authenticated user only.
Step-9: What Permission do you want to grant to Authenticated users? Create, Read,
Update,Delete.
Step-10: Do you want to add another path? NO.
(J) : Update the app to use the API to query Amazon Linux 2 AMI data.
Overview: In this task, you will update your app to interact with the secure
REST API and query for Amazon Linux 2 AMI data based on x86_64 or arm64
architecture.
Step-1: cd ~/environment/ec2-vendor.
Step-2: amplify add hosting.
Step-1: cd ~/environment/ec2-vendor.
Step-2: amplify delete.