C02STG51GTFM:localstack mpandit$ make infra
. .venv/bin/activate; exec localstack/mock/infra.py
Starting local dev environment. CTRL-C to quit.
Starting local Elasticsearch (port 4571)...
Starting mock ES service (port 4578)...
Starting mock S3 server (port 4572)...
Starting mock SNS server (port 4575)...
<?xml version='1.0' encoding='UTF-8'?> | |
<maven2-moduleset plugin="[email protected]"> | |
<actions/> | |
<description></description> | |
<keepDependencies>false</keepDependencies> | |
<properties/> | |
<scm class="hudson.plugins.git.GitSCM" plugin="[email protected]"> | |
<configVersion>2</configVersion> | |
<userRemoteConfigs> | |
<hudson.plugins.git.UserRemoteConfig> |
In this tutorial, we will create and deploy a java-maven based serverless service using the serverless project (https://serverless.com/). In this part we will not modify any code, or even look at the generated code. We will focus on the deployment and the command line interface provided by serverless. Serverless is a node.js based framework that makes creating, deploying, and managing serverless functions a breeze. We will use AWS as our FaaS (Function-as-a-Service) provider.
Here is what the setup on my Mac looks like (Sierra)
brew
(1.1.10) - you will need this if you do not have node/npm installed already.node
(v7.6.0)npm
(4.1.2)Apache Maven
(3.2.5)
Lambda is the key enabler and a core AWS component for serverless computing. Lets you run the code you want, without worrying about the underlying infrastructure and provisioning. It is also cost efficient, as there are no instances that are in running state but idle. Lambda handles scaling up and scaling down as needed, transparently to the customer.
-
Event Source - Changes in state of the resources or data, or any events triggered explicitly or implicitly. A large number of AWS services can act as Event Sources - Like S3 (Object PUT, DELETE..), DynamoDB, IoT, CloudFormation, CloudWatch, SNS, API Gateway and Cron schedule to name a few.
-
Function - The piece of code that would be run when that event occurs. The function can access any services downstream if needed. Currently Supported languages are Node.js, Python, Java 8 and C#.
- Stateless, event-based file/data processing.
import java.io.*; | |
import java.util.*; | |
import java.text.*; | |
import java.math.*; | |
import java.util.regex.*; | |
public class Solution { | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); |
You can download the PDF of the questions here
- Which of the following statements about SQS is true?
- A. Messages will be delivered exactly once and messages will be delivered in First in, First out order
- B. Messages will be delivered exactly once and message delivery order is indeterminate
- C. Messages will be delivered one or more times and messages will be delivered in First in, First out order
- D. Messages will be delivered one or more times and message delivery order is indeterminate
- Single database running on single instance
- Every record has a
tenant_id
as a part of the composite primary key. - Application will need to provide this
tenant_id
for every query as a part of the where clause
- One database, one instance
- Relatively easy to run cross-tenant queries
- Can start an AMI to create any number of on-demand instances by using the RunInstances call. Default max is 20 per account.
- If the request is good, the RunInstances call returns success with a list of DNS names, and instances begin to launch within 10 minutes.
- The launch request is associated with a reservation ID. One reservation ID can map to multiple instances which are all a part of one launch request.
- The status can be checked via DescribeInstances call
- Can be terminated using TerminateInstances call
- If a running instances uses EBS-backed root volume (boot partition), it can be stopped by StopInstances call. This preseves the data.
- The same can be done via CLI or the Console instead of REST APIs
- EBS based root device store will preserve data, hence it is not tied to the life of the instance. Local instance based store presisence is tied to the life of the instance. There is no "stop" option.
- Head to https://docs.docker.com/docker-for-mac/
- Download the latest docker binary from https://download.docker.com/mac/stable/Docker.dmg
- Install it (drag and drop)
- Go to applications, and click on the Docker icon, it will walk you through the rest of the setup.
- You can notice the docker whale animating in the toolbar at the top right of your mac as it initalizes.
- You can click that whale to see the current status of docker engine.
- What has been installed is the docker engine (to manage and run containers), docker machine (the host) and docker compose.
- We will also need virtualbox, so install it from https://www.virtualbox.org/wiki/Downloads
public static String binary(int input){ | |
StringBuilder builder = new StringBuilder(); | |
int numerator = input; | |
while(true){ | |
int divisor = numerator/2; | |
int remainder = numerator%2; | |
builder.append(remainder+""); | |
numerator = divisor; | |
if(divisor==1){ | |
builder.append("1"); |