Git Product home page Git Product logo

actuarial-reserve-modelling's Introduction

Actuarial-Reserve-Modelling

Actuarial modeling is a key component in the insurance industry, used for analyzing and predicting various risks and potential losses. Due to the complexity of calculations involved, actuarial modeling requires significant computing power and resources. This is where AWS services such as AWS High Performance Computing (HPC) services come in. This repository is an addtion to this blog post where we walk you through on how we can deploy scalable and cost-effective solution for actuarial computing using AWS services.

Before you begin

It is recommended to run it on a machine other than Mac with M1 chip due to the differences of docker image OS architecture version that M1 chip produces versus what AWS Batch expects. For smooth running, we advise spinning up an AWS Cloud9 instance, copy this git repository to your Cloud9 instance environment and proceed with steps below. If you proceed with Cloud9 instance, make sure you attach an IAM Role to the instance in the EC2 console.

Prerequisites

Deploy infrastructure

  • Run cdk bootstrap --require-approval never && cdk deploy --require-approval never. This will build a docker image and push it to Amazon ECR, deploy the infrastructure and copy policy_[*].csv files to the Amazon S3 bucket.
  • This process will take ~15-20 minutes for everything to provision.
  • After cdk command succesfully executed, copy ActuaryCalculationStack.EventBridgeRuleName value and ActuaryCalculationStack.LambdaFunctionName from the cdk ouput in your terminal/command line and save them in a text editor of your choice. We will need these values later.

Submitting batch job

  • Navigate to the root aws-reserve-modelling/ directory and run aws batch submit-job --cli-input-json file://test-10-workers.json to test with 10 workers (you can also use test-10-workers.json or test-5-workers.json or simply create another json with different amount of workers based on the templates we included).
  • Copy jobId value from the cli output.
  • Run aws events put-rule --name "ActuaryCalculationStack.EventBridgeRuleName" --event-pattern "{\"source\":[\"aws.batch\"],\"detail-type\":[\"Batch Job State Change\"],\"detail\":{\"jobId\":[\"jobIdValue\"],\"status\":[\"SUCCEEDED\"]}}"
    • Substitute ActuaryCalculationStack.EventBridgeRuleName with rule name that you got in step 8.
    • Substitute jobIdValue with jobId that you got in step 10.

Navigating to the AWS Batch console

  • Navigate to the AWS Batch console and see the results in the logs of workers.
  • Go to the Jobs tab, then select actuary-computing-job-queue from the drop down menu.
  • You can observe the result of the child jobs here and wait until the status of a parent jobs changes for SUCCEEDED.

Navigate to the AWS Lambda console

  • After execution of your Batch jobs is completed, navigate to your AWS Lambda function (you can find by ActuaryCalculationStack.LambdaFunctionName name that you copied in the above section).
  • Select CloudWatch logs tabs and you will be redirected to Amazon CloudWatch console where you can see the average reserves across all of your workers in the logs.
  • Look for the The total reserves line in the logs.

Clean-up

To destroy the infrastructure, run cdk destroy --force inside the /actuary/infrastructure folder. This will delete all the resources that were provisioned in the blog post.

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

actuarial-reserve-modelling's People

Contributors

amazon-auto avatar maxtybar avatar rppth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.