[{"data":1,"prerenderedAt":72},["ShallowReactive",2],{"pattern-lambda-s3-cfn":3},{"id":4,"title":5,"architectureURL":6,"cleanup":7,"contributors":12,"deploy":14,"description":17,"extension":18,"framework":19,"gitHub":20,"highlight":6,"introBox":29,"language":34,"level":35,"meta":36,"patternArch":37,"resources":55,"s3URL":64,"services":65,"stem":66,"testing":67,"videoId":28,"__hash__":71},"patterns\u002Fpatterns\u002Flambda-s3-cfn.json","AWS Lambda to Amazon S3 via a custom resource",null,{"headline":8,"text":9},"Cleanup",[10,11],"1. Delete the stack: \u003Ccode>sam delete --stack-name STACK_NAME\u003C\u002Fcode>.","2. Confirm the stack has been deleted: \u003Ccode>aws cloudformation list-stacks --query \"StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus\"\u003C\u002Fcode>",[13],"content\u002Fcontributors\u002Fgreg-davis.json",{"text":15},[16],"sam deploy --guided","Creates a Lambda function that writes to an S3 bucket during deployment.","json","AWS SAM",{"template":21,"payloads":26},{"projectFolder":22,"repoURL":23,"templateURL":24,"templateFile":25},"cfn-custom-resource-s3-create","https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-patterns\u002Ftree\u002Fmain\u002Fcfn-custom-resource-s3-create","serverless-patterns\u002Fcfn-custom-resource-s3-create","template.yml",[27],{"headline":28,"payloadURL":28},"",{"headline":30,"text":31},"How it works",[32,33],"This pattern creates an Amazon S3 object by using an AWS CloudFormation custom resource and an AWS Lambda function. Custom resources enable you to write custom provisioning logic in templates that CloudFormation runs anytime you create, update (if you changed the custom resource), or delete stacks.","This pattern deploys a Lambda function that is responsible for creating (and deleting) S3 objects. The function is given CRUD permissions on objects in the S3 bucket. When the stack is first created, CloudFormation sends a create request to the function. When the stack is deleted, CloudFormation sends a delete request to the function. The function ARN is stored as a CloudFormation Export named \"function-s3-create\".","Python","300",{},{"icon1":38,"icon2":43,"icon3":46,"line1":50,"line2":53},{"x":39,"y":40,"service":41,"label":42},20,50,"cfn","CloudFormation",{"x":40,"y":40,"service":44,"label":45},"lambda","AWS Lambda",{"x":47,"y":40,"service":48,"label":49},80,"s3","Amazon S3",{"from":51,"to":52},"icon1","icon2",{"from":52,"to":54},"icon3",{"headline":56,"bullets":57},"Additional resources",[58,61],{"text":59,"link":60},"AWS CloudFormation custom resources","https:\u002F\u002Fdocs.aws.amazon.com\u002FAWSCloudFormation\u002Flatest\u002FUserGuide\u002Ftemplate-custom-resources.html",{"text":62,"link":63},"S3-to-Lambda application patterns","https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fs3-to-lambda-patterns","https:\u002F\u002Fda-public-assets.s3.amazonaws.com\u002Fpatterns\u002Flambda-s3-cfn\u002Fcloudformation.yml",{"from":44,"to":48},"patterns\u002Flambda-s3-cfn",{"headline":68,"text":69},"Testing",[70],"See the GitHub repo for detailed testing notes.","gzjleRVyhJBbJEaiB5clBBnqMnyQD1PFg4nYPOxm-Yc",1781606115143]