Posts

Showing posts from October, 2019

AWS - Run tasks with AWS Fargate and Lambda

Image
Repost from  https://lobster1234.github.io/2017/12/03/run-tasks-with-aws-fargate-and-lambda/ As with any other financial company, at  Marqeta , we have a good number of batch jobs, which we are migrating over to  AWS Batch . However, even in managed mode, AWS Batch needs us to define  Compute Environments , which are clusters of EC2 instances running ECS (and Docker) agents. AWS Fargate  was  announced  very recently at re:Invent 2017. Fargate adds a layer of abstraction on top of the Compute Environment, or the ECS Cluster. We no longer have to worry about the AMI, EC2 types, task placement, etc. In this post I cover the POC done to use Fargate over AWS Batch for batch processing, but this can also be used as a tutorial for running any type of tasks using Fargate. We create an ECS Task definition, a Fargate Cluster, and a Lambda to run the task using CloudWatch Event trigger. Setup We will use the AWS Console, but everything in the console...

AWS - configure a Lambda function to assume a role from another AWS account

Repost from  https://aws.amazon.com/premiumsupport/knowledge-center/lambda-function-assume-iam-role/ I need my AWS Lambda function to assume a role from another AWS account to perform a specific task. How can I configure that? Short Description You can give a Lambda function created in one account ("account A") permissions to assume a role from another account ("account B") to  access resources such as an Amazon Simple Storage Service (Amazon S3) bucket , or to do tasks such as  starting and stopping instances . To do this, configure two  AWS Identity and Access Management (IAM) roles : Execution role  – The primary role in account A that gives the Lambda function permission to do its work. Assumed role  – A role in account B that the Lambda function in account A assumes to gain access to cross-account resources. For more information, see  AWS Lambda Permissions . Resolution 1.     Attach this IAM policy ...