如何销毁一个SAM本地lambda?

时间:2018-01-18 15:32:34

标签: amazon-web-services lambda aws-sam-cli

按照阅读说明:

# AWS SAM Hello World Example #

A simple AWS SAM template that specifies a single Lambda function.

## Usage ##

To create and deploy the SAM Hello World example, first ensure that you've met the requirements described in the [root README](../../README.md). Then
follow the steps below.

### Test your application locally ###

Use [SAM Local](https://github.com/awslabs/aws-sam-local) to run your Lambda function locally:

    sam local invoke "HelloWorldFunction" -e event.json

### Package artifacts ###

Run the following command, replacing `BUCKET-NAME` with the name of your bucket:

    sam package --template-file template.yaml --s3-bucket BUCKET-NAME --output-template-file packaged-template.yaml

This creates a new template file, packaged-template.yaml, that you will use to deploy your serverless application.

### Deploy to AWS CloudFormation ###

Run the following command, replacing `MY-NEW-STACK` with a name for your CloudFormation stack.

    sam deploy --template-file packaged-template.yaml --stack-name MY-NEW-STACK --capabilities CAPABILITY_IAM

This uploads your template to an S3 bucket and deploys the specified resources using AWS CloudFormation.

现在什么是删除整个堆栈的sam本地命令,包括s3存储桶和CF堆栈?

1 个答案:

答案 0 :(得分:9)

目前没有sam命令可以删除所有这些资源。您只需使用相关的aws cli命令,无论如何sam-cli只是一个包装器。删除CFN堆栈的示例。

aws cloudformation delete-stack --stack-name MY-NEW-STACK