Download as pdf or txt
Download as pdf or txt
You are on page 1of 50

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.

Agenda

10.00 Bienvenida. Desarrollo de aplicaciones modernas

10.05 Nuevas funcionalidades para desarrollar aplicaciones

11:05 Arquitecturas Orientadas a eventos

12:00 Break
Kubernetes empresarial con EKS. Integraciones y ejecución
12:10
sobre entornos serverless con Fargate
13:05 Ejecución de contenedores a escala con instancias de Spot

14.00 Wrap-up

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Who we are

Alfredo Velasco Eugenio Viudez Jesús Escudero Isaac Valhonrat


Serverless BDM AWS Solutions Architect AWS Solutions Architect Spot Specialist SA
alfrevel@amazon.com eviudez@amazon.com jeeslo@amazon.com ivallhon@amazon.com

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Modern Application Development
Achieving excellence in the cloud

Alfredo Velasco
Modern App Development – Serverless Specialist

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Application Stategies

Reduce the size of your estate Migrate to AWS Modernize on AWS

Retire Replatform
Rehost
“Lift and shift” Refactor
SaaS

New & existing business


Modern PaaS critical applications
(SSP)
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
A modern application architecture

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Nuevas funcionalidades para
desarrollar aplicaciones en AWS

Alfredo Velasco
Modern App Development – Serverless Specialist

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Amazon views serverless as the native architecture
of the cloud

No provisioning, Automatic Pay for Highly available


no management scaling value and secure

Serverless-first is the decision to opt for serverless technologies


in your application as a first choice.

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Comparison of operational responsibility - Compute

AWS manages Customer manages


More opinionated

• Data source integrations • Application code


AWS Lambda • Physical hardware, software, networking,
Serverless functions and facilities
• Provisioning

• Container orchestration, provisioning • Application code


AWS Fargate • Cluster scaling • Data source integrations
Serverless containers • Physical hardware, host OS/kernel, • Security config and updates, network config,
networking, and facilities management tasks

• Container orchestration control • Application code


ECS/EKS plane • Data source integrations
Container-management as a • Physical hardware software, • Work clusters
service networking, and facilities • Security config and updates, network
config, firewall, management tasks
• Physical hardware software, • Application code
networking, and facilities • Data source integrations
EC2 • Scaling
Infrastructure-as-a-Service
• Security config and updates, network
config, management tasks
Less opinionated
• Provisioning, managing scaling and
patching of servers

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Part of the AWS Serverless Portfolio

APPLICATION PRIMITIVES – COMPUTE AND DATASTORES

AWS
Amazon AWS Amazon Amazon Aurora Amazon
Lambda
S3 Fargate DynamoDB Serverless Kinesis

APPLICATION INTEGRATION

Amazon Amazon AWS Amazon Amazon Amazon AWS


SNS API Gateway Step Functions EventBridge MQ SQS AppSync

DEVELOPER TOOLS

AWS AWS AWS AWS AWS Amazon AWS AWS Serverless


CloudFormation Cloud9 CodePipelin Confi CloudTrail CloudWatch X-Ray Application
e g Repository

SECURITY AND ADMINISTRATION

AWS AW Amazon Amazon Amazon AW AWS Amazon


IAM S GuardDuty Inspector VPC S Shield Cognito
SS WA
O F
AWS Lambda

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Serverless applications

Event source Function Services

Changes in Node.js
data state Python
Java
Requests to C#
endpoints Go
Ruby
Changes in Runtime API
resource state

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Lambda execution model
Synchronous (push) Asynchronous (event) Stream (poll-based)

Amazon
Amazon API DynamoDB
Amazon
Gateway SNS
Amazon
Kinesis
Amazon
S3
Amazon SQS
/order
reqs
changes

AWS Lambda
Lambda Lambda service
function function

function
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
AWS Lambda Destinations

Designate an asynchronous target for Lambda function invocation results. You


can set one destination for a success, and another for a failure.
Dealing With Sparse Data Streams Off Peak

• By default, Lambda poller fetches


data every second.

• Batch Window allows to batch up to


300s before invocation. Great for
cost optimization when traffic
volume is low.

• Invocation criteria:
• 6MB payload
• Maximum Batch Window
• Maximum Batch Size
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Dealing With Data Streams Spikes

• By default, Lambda invokes one


batch on one instance per shard.
Parallelization Factor allows you
to have up to 10 batches on 10
instances per shard. Order is
maintained at partition key level.

• Use CloudWatch Metric to trigger


Parallelization Factor based on
your level of acceptance for
iteratorAge.

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Enhanced Controls on Stream Processing

Skip processing old records using MaximumRecordAge (60s to 7 days)

Specify how many retries on a record with MaximumRetryAttempt (0 to


10,000).

Send metadata (batch info, request context) of failed records to


SNS/SQS using on-failure destination

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Trace Down Bad Records with BisectOnFunctionError

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Amazon SQS FIFO as an event source
Provisioned Concurrency for AWS Lambda

• Applications that have strict latency


SLAs
• Have direct interaction with end-users
• Have strict regulatory requirements
• Leverage languages that have a slower
cold start time or require large
deployment packages
• Applications that support high-
velocity traffic bursts
• Serve content such as ads during a live
stream
• Mobile applications such as games
• Marketing blitzes or flash sales
Amazon Elastic File System (EFS) for Lambda

• Share data across 1000s of function


invocations AWS
Lambda
Availability zone Availability zone

• Achieve high performance, highly


available, durable storage with
persistent volumes
EFS EFS
Mount Mount
• Pay only for what you use Target Target

Amazon
EFS
file system
New Workloads on AWS Lambda
Simplify Application Architecture
Process files of any size
Reduce Costs

Large File Large Scale AI/ML Realtime


Data manipulation Media Processing Analytics applications

Zip/Archives High Res Images MXNet Content Management


Git HD Videos TensorFlow Web apps

22
Amazon API Gateway

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
API Architecture
Lambda
Functions

Amazon API Gateway


Public
Endpoints on

Edge-Optimized
Fully-managed Amazon EC2
Mobile client API Gateway Cache
CloudFront (REST only)
Distribution
HTTPS Any other
AWS service

Websites
All publicly
accessible
Customer-managed endpoints
CloudFront Distribution

Regional
Services
Endpoints
Applications in VPC
& Services
in the same
AWS Region AWS Direct
Connect
Private

Applications
& Services Amazon
in VPC CloudWatch On-premises
Monitoring
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Types of APIs: Supported Protocol Details

RESTful: HTTP APIs & REST APIs WebSocket APIs

Client Client

• Request / Response • Serverless WebSocket


• HTTP Methods like GET, POST, etc • 2 way communication channel
• Short-lived communication • Long-lived communication
• Stateless • Stateful

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
26
HTTP APIs for Amazon API Gateway
Achieve up to 70% cost reduction and 60% latency reduction
compared to REST APIs.

Reduce application costs Reduce application Configure HTTP APIs


by up to 70% latency by up to 60% easier and faster than
before
HTTP APIs for Amazon API Gateway

• JWT Authorizers - supports native OpenID Connect (OIDC)


authorization. You can configure API Gateway to parse incoming JWT
tokens, and allow or deny requests based on the OAuth scopes in the
token.
• Default Stages and Routes - make it easier to work with APIs. When
you assign a default stage, you are able to serve your API from the
base URL. This means you no longer need an explicit stage in your
API.
• Fully customizable CORS experience.
Protect your APIs

• Resource Policies:
• Apply global security for the entire API
• IAM Authorization:
• Provides AuthN & AuthZ via IAM credentials (new for HTTP APIs)
• Lambda Authorizer: (aka custom authorizer)
• Perform any type of Auth required. ie. Basic, Oauth, etc (new for HTTP APIs)
• Cognito Authorizer:
• Integrate with Cognito User Pools
• JWT and OpenID Connect
• Available in HTTP APIs

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
AWS Step Functions

Make it simple to:


Coordinate and run multistep applications.

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Turning functions into apps
“I want to invoke
“I want to sequence “I want to retry “I want to run tasks another Step
tasks” failed tasks” in parallel” Functions”

C
A B A A B A
Parallel State

“I want
A try/catch/finally” “I want to dynamically run
“I want to wait for a
Callback
tasks in parallel”

B ? C A A C A Services
“I want to select tasks
based on data” Map State
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Two Workflow Types

EXPRESS
STANDARD
WORKFLOWS

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Workflows Types
Flexibility to select the right workflow type for your needs, or integrate them together where needed

Standard Workflows Express Workflows


• Long-running, durable and auditable • Simplified capabilities, geared for speed
workflows and scale. Supporting event rates up to
• Pay per state transition 100,000 per second

• IT automation, Report generation, Order • Pay per use at $0.20 per million requests
processingPayment and billing and $0.000000312 per second
processing. Machine learning model
training • High volume data processing, IoT data
ingestion, Order / cart validation,
• Integrations with long-running tasks on Payment reconciliation
AWS services - AWS Batch, AWS Fargate,
Amazon SageMaker, and AWS Glue • Does not log events into DB
• Max execution time of 5 mins

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Developer Experience
Tooling

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
AWS Serverless Application Model (SAM)

CloudFormation extension optimized for serverless

Serverless resources: Api, Application, Function, HttpApi,


LayerVersion, SimpleTable and StateMachine

Open specification (Apache 2.0)

AWS SAM CLI: create, build, test and deploy your applications

https://github.com/awslabs/serverless-application-model
https://github.com/awslabs/aws-sam-cli
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Local testing

• Local substitutes (e.g. DynamoDB


Local) might not have feature
How to mock parity
• They don't test IAM policies and
things locally? configuration
Should I use local • You can test those through
substitutes for integrations tests
AWS services? • You can mock the AWS SDKs
(e.g. moto, botocore Stubber,
implement interfaces)

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
AWS Deploy : Dev/Preprod or Prod Environment

Terraform CloudFormation CDK

Serverless Stackery Amplify


SAM

Laconia
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
CI/CD Pipeline

CI/CD
AWS
CodePipeline

AWS CodeCommit AWS CodeBuild AWS SAM/ AWS Codebuild AWS SAM /
Build CloudFormation Integration tests CloudFormation
Unit tests

Role Role

Staging
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. Prod
Developer Experience
Observability

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Three pillars of observability

Metrics Logs Traces

Numeric data measured Timestamped records of A trace represents a single


at various time intervals discrete events that user’s journey across
multiple applications and
(time series data); SLIs happened within an
systems (usually
(request rate, error rate, application or system,
microservices)
duration, CPU%, etc.) such as a failure, an error,
or a state transformation

Definitions from: Distributed Systems Observability


https://www.oreilly.com/library/view/distributed-systems-observability/9781492033431/

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Serverless Observability

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
AWS Lambda Ready Monitoring Partners

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
CloudWatch built-in metrics:

AWS Lambda Amazon API Gateway


Invocation Metrics REST
• Invocation Count, Invocation Errors, • API Calls Count, Latency, 4XXs,
DeadLetterErrors, 5XXs, Integration Latency, Cache
DestinationDeliveryFailures, Throttles, Hit Count, Cache Miss Count
ProvisionedConcurrencyInvocations, HTTP
ProvisionedConcurrencySpilloverInvocatio
ns • API Calls Count, Latency, 4XXs,
5XXs, Integration Latency,
Performance Metrics DataProcessed
• Duration, IteratorAge
WebSocket
Concurrency Metrics • Connect Count, Message Count,
• ConcurrentExecutions, Integration Error, Client Error,
ProvisionedConcurrentExecutions, Execution Error, Integration
ProvisionedConcurrencyUtilization, Latency
UnreservedConcurrentExecutions
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
CloudWatch Embedded Metrics Format
• Embed custom metrics alongside detailed log event data, and
CloudWatch will automatically extract the custom metrics so you can
visualize and alarm on them, for real-time incident detection
• Open-source client libraries available for Node.js and Python

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
AWS Lambda API Extensions
PREVIEW
Ø Let customers run agents by extending Lambda’s execution
environment

What are the target use cases?


Ø Integrate Lambda with partner security, monitoring, or observability tools

Ø Manage secrets / token renewal process, run daemon to collect metrics over UDP,
transport telemetry to any destination directly from the Lambda environment

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Lambda Lifecycle Visibility Pre-Extensions

Execution
environment
Customers must embed code
into the function logic in
order to gain visibility during
PREVIEW
spun up function invocation
Duration

Execution
Invoke environment
Invoke spun down

Time
CloudWatch and X-Ray

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Lambda Extended Lifecycle
Execution
environmen
t spun up

PREVIEW
Duration

Execution
Invoke environment
Invoke spun down

Time

Enable
Ideally, run when there is something to Provide time after the invoke Provide time for
customers
do, and not run when there is nothing to to get telemetry about this some clean-up /
and
do. invoke out final tasks
partners to
start
services
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
CloudWatch Lambda Insights
PREVIEW
Ø Provides access to automated dashboards summarizing the performance and
health of your Lambda functions that provide visibility into issues such as
memory leaks or performance changes caused by new function versions.

Ø Multi-function view to understand how compute, memory allocation, and


function duration changes over time to optimize Lambda function utilization.

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
CloudWatch ServiceLens
Unified access to metrics, logs, traces and canaries.
Enabling performance monitoring from end-user interaction to infrastructure layer
insights Amazon CloudWatch AWS X-Ray

Metrics Traces
Logs Analytics
Events Service Map
Alarms Latency detection
Dashboards (server & client)

ServiceLens
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Thank you

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.

You might also like