aws black belt techシリーズ aws lambda updates

Download AWS Black Belt Techシリーズ AWS Lambda Updates

Post on 12-Feb-2017

8.602 views

Category:

Technology

1 download

Embed Size (px)

TRANSCRIPT

  • AWS Lambda UpdatesKeisuke Nishitani (@Keisuke69)

    Amazon Web Services Japan K.K.

  • Profile

    Keisuke NishitaniSolutions Architect, Amazon Web Service Japan K.K

    @Keisuke69 Keisuke69

    AWS Web

    1 REST Lambda Wizards

    Keisuke69 Keisuke69Keisuke69x

  • AWS Lambda Updates

    Blueprint

    Python 2.7

    VPC

  • Blueprint

  • Blueprint

    Lambda

    Slack

    20163240Node.jsPython

  • Blueprint

  • Blueprint

  • Python 2.7

  • Python 2.7

    LambdaPython2.7

    Mobile SDKSDK

    CLI

    Blueprint

  • handler

    event

    context

    RequestResponse Lambda

    Event

    Null

    def handler_name(event, context):... return some_value

  • Context

    context2

    get_remaining_time_in_millis()

    function_name

    function_version

    invoked_function_arnARNARNARN

    memory_limit_in_mb

    aws_request_idAWS IDinvoke ID

    log_group_nameCloudWatch

    log_stream_nameCloudWatch

    IdentityAmazon CognitoMobile SDK

    client_contextMobile SDK

  • Logging

    CloudWatch Logs

    print

    loggingLogger

    logging

  • JSON

    RequestResponseEventCloudWatch Logs

    def lambda_handler(event, context):raise Exception('failed')

    {"stackTrace": [

    ["/var/task/lambda_function.py",14,"lambda_handler","raise Exception('failed')" ]

    ],"errorType": "Exception","errorMessage": "failed}

  • 5

    CloudWatch Events Schedule

    Cron

    CLISDK

  • rate(Value Unit)

    Value

    Unit

    5 => rate(5 minites)

    1 => rate(1 hour)

    7 => rate(7 days)

    ValueUnit

  • cron(Minutes Hours Day-of-month Month Day-of-week Year)

    UTC

    10:00 => cron(0 10 * * ? *)

    06:00 => cron(0 18 ? * MON-FRI *)

    8:00 => cron(0 8 1 * ? *)

    10 => cron(0/10 * ? * MON-FRI *)

    8:00 5:555=> cron(0/5 8-17 ? * MON-FRI *)

  • Cron

    / minutes 0/1515

    L "" Day-of-month Day-of-week ()

    W 5/W 5 5 5

    # n 3#2 2 7 3

    * Day-of-month

    ?

    - 10-12 1011 12

    , SUN, MON, TUE

    / 5/10 5152535

  • Lambda

    Lambda/publish

    PublishVersion

    $LATEST

    exports.handler =

    function(event,context)

    {context.succeed(bye);}

    exports.handler =

    function(event,context)

    {context.succeed(hi);}

    Version:1

    Version:2

  • Version: 1Arias: Prod

    Version: $LATESTArias: Dev

    Version: 1 Version: $LATESTArias: Dev

    Version: 2Arias: Prod

    Prod12

  • :FunctionName

    FunctionName:$LATEST

    FunctionName:1

    FunctionName:2

    :FunctionName:production

    FunctionName:v1_2_3_4

  • 60300

    CloudWatch Events

    1.5GB75GB

  • VPC

    Photo credit: Matthew Wilkinson via Visual Hunt / CC BY-ND

    https://www.flickr.com/photos/manc72/9676465202/https://visualhunt.com/http://creativecommons.org/licenses/by-nd/2.0/

  • VPC

    VPC Amazon Elasticache

    Amazon RDS

    Private EC2 endpoints

    VPC

    VPCLambdaVPC AZ

    Elastic Network Interface(ENI) Lambda ENIIPDHCP IAM RoleAWSLambdaVPCAccessExecutionRole

    Photo credit: Matthew Wilkinson via Visual Hunt / CC BY-ND

    https://www.flickr.com/photos/manc72/9676465202/https://visualhunt.com/http://creativecommons.org/licenses/by-nd/2.0/

  • Demo

  • Photo credit: Matthew Wilkinson via Visual Hunt / CC BY-ND

    VPC

    NAT

    ENI IP

    CloudWatch Logs

    ENI

    Projected peak concurrent executions * (Memory in GB / 1.5GB)

    https://www.flickr.com/photos/manc72/9676465202/https://visualhunt.com/http://creativecommons.org/licenses/by-nd/2.0/

  • Photo credit: Matthew Wilkinson via Visual Hunt / CC BY-ND

    VPCFAQ

    IPENILambda

    IPVPCManaged Nat GatewayNATIP

    https://www.flickr.com/photos/manc72/9676465202/https://visualhunt.com/http://creativecommons.org/licenses/by-nd/2.0/

  • Photo credit: Matthew Wilkinson via Visual Hunt / CC BY-ND

    VPCFAQ

    Lambda

    DirectConnectVPN

    https://www.flickr.com/photos/manc72/9676465202/https://visualhunt.com/http://creativecommons.org/licenses/by-nd/2.0/

  • Photo credit: Matthew Wilkinson via Visual Hunt / CC BY-ND

    VPCFAQ

    LambdaENI1060

    ENILambdaENILambda

    https://www.flickr.com/photos/manc72/9676465202/https://visualhunt.com/http://creativecommons.org/licenses/by-nd/2.0/

  • Webinar

    AWS

    http://aws.amazon.com/jp/aws-jp-introduction/

    AWS Solutions Architect

    Q&A

    http://aws.typepad.com/sajp/

    http://aws.amazon.com/jp/aws-jp-introduction/http://aws.typepad.com/sajp/