diff --git a/samcli/local/init/templates/cookiecutter-aws-sam-hello-dotnet/{{cookiecutter.project_name}}/README.md b/samcli/local/init/templates/cookiecutter-aws-sam-hello-dotnet/{{cookiecutter.project_name}}/README.md index 17d9cf30ec..63c74c5d4e 100644 --- a/samcli/local/init/templates/cookiecutter-aws-sam-hello-dotnet/{{cookiecutter.project_name}}/README.md +++ b/samcli/local/init/templates/cookiecutter-aws-sam-hello-dotnet/{{cookiecutter.project_name}}/README.md @@ -23,44 +23,26 @@ The Serverless Application Model Command Line Interface (SAM CLI) is an extensio To use the SAM CLI, you need the following tools. -* AWS CLI - [Install the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html) and [configure it with your AWS credentials]. * SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) * .NET Core - [Install .NET Core](https://www.microsoft.com/net/download) * Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community) -The SAM CLI uses an Amazon S3 bucket to store your application's deployment artifacts. If you don't have a bucket suitable for this purpose, create one. Replace `BUCKET_NAME` in the commands in this section with a unique bucket name. +To build and deploy your application for the first time, run the following in your shell: ```bash -{{ cookiecutter.project_name }}$ aws s3 mb s3://BUCKET_NAME +sam build +sam deploy --guided ``` -To prepare the application for deployment, use the `sam package` command. +The first command will build the source of your application. The second command will package and deploy your application to AWS, with a series of prompts: -```bash -{{ cookiecutter.project_name }}$ sam package \ - --output-template-file packaged.yaml \ - --s3-bucket BUCKET_NAME -``` - -The SAM CLI creates deployment packages, uploads them to the S3 bucket, and creates a new version of the template that refers to the artifacts in the bucket. +* **Stack Name**: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name. +* **AWS Region**: The AWS region you want to deploy your app to. +* **Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes. +* **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modified IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command. +* **Save arguments to samconfig.toml**: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application. -To deploy the application, use the `sam deploy` command. - -```bash -{{ cookiecutter.project_name }}$ sam deploy \ - --template-file packaged.yaml \ - --stack-name {{ cookiecutter.project_name }} \ - --capabilities CAPABILITY_IAM -``` - -After deployment is complete you can run the following command to retrieve the API Gateway Endpoint URL: - -```bash -{{ cookiecutter.project_name }}$ aws cloudformation describe-stacks \ - --stack-name {{ cookiecutter.project_name }} \ - --query 'Stacks[].Outputs[?OutputKey==`HelloWorldApi`]' \ - --output table -``` +You can find your API Gateway Endpoint URL in the output values displayed after deployment. ## Use the SAM CLI to build and test locally @@ -123,11 +105,10 @@ Tests are defined in the `test` folder in this project. ## Cleanup -To delete the sample application and the bucket that you created, use the AWS CLI. +To delete the sample application that you created, use the AWS CLI. Assuming you used your project name for the stack name, you can run the following: ```bash -{{ cookiecutter.project_name }}$ aws cloudformation delete-stack --stack-name {{ cookiecutter.project_name }} -{{ cookiecutter.project_name }}$ aws s3 rb s3://BUCKET_NAME +aws cloudformation delete-stack --stack-name {{ cookiecutter.project_name }} ``` ## Resources diff --git a/samcli/local/init/templates/cookiecutter-aws-sam-hello-golang/{{cookiecutter.project_name}}/README.md b/samcli/local/init/templates/cookiecutter-aws-sam-hello-golang/{{cookiecutter.project_name}}/README.md index 2d783abbc2..8645d7d669 100644 --- a/samcli/local/init/templates/cookiecutter-aws-sam-hello-golang/{{cookiecutter.project_name}}/README.md +++ b/samcli/local/init/templates/cookiecutter-aws-sam-hello-golang/{{cookiecutter.project_name}}/README.md @@ -77,38 +77,21 @@ AWS Lambda Python runtime requires a flat folder with all dependencies including ... ``` -First and foremost, we need a `S3 bucket` where we can upload our Lambda functions packaged as ZIP before we deploy anything - If you don't have a S3 bucket to store code artifacts then this is a good time to create one: +To deploy your application for the first time, run the following in your shell: ```bash -aws s3 mb s3://BUCKET_NAME +sam deploy --guided ``` -Next, run the following command to package our Lambda function to S3: +The command will package and deploy your application to AWS, with a series of prompts: -```bash -sam package \ - --output-template-file packaged.yaml \ - --s3-bucket REPLACE_THIS_WITH_YOUR_S3_BUCKET_NAME -``` - -Next, the following command will create a Cloudformation Stack and deploy your SAM resources. - -```bash -sam deploy \ - --template-file packaged.yaml \ - --stack-name {{ cookiecutter.project_name.lower().replace(' ', '-') }} \ - --capabilities CAPABILITY_IAM -``` - -> **See [Serverless Application Model (SAM) HOWTO Guide](https://github.com/awslabs/serverless-application-model/blob/master/HOWTO.md) for more details in how to get started.** +* **Stack Name**: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name. +* **AWS Region**: The AWS region you want to deploy your app to. +* **Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes. +* **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modified IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command. +* **Save arguments to samconfig.toml**: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application. -After deployment is complete you can run the following command to retrieve the API Gateway Endpoint URL: - -```bash -aws cloudformation describe-stacks \ - --stack-name {{ cookiecutter.project_name.lower().replace(' ', '-') }} \ - --query 'Stacks[].Outputs' -``` +You can find your API Gateway Endpoint URL in the output values displayed after deployment. ### Testing @@ -153,25 +136,6 @@ If it's already installed, run the following command to ensure it's the latest v ```shell choco upgrade golang ``` -## AWS CLI commands - -AWS CLI commands to package, deploy and describe outputs defined within the cloudformation stack: - -```bash -sam package \ - --template-file template.yaml \ - --output-template-file packaged.yaml \ - --s3-bucket REPLACE_THIS_WITH_YOUR_S3_BUCKET_NAME - -sam deploy \ - --template-file packaged.yaml \ - --stack-name {{ cookiecutter.project_name.lower().replace(' ', '-') }} \ - --capabilities CAPABILITY_IAM \ - --parameter-overrides MyParameterSample=MySampleValue - -aws cloudformation describe-stacks \ - --stack-name {{ cookiecutter.project_name.lower().replace(' ', '-') }} --query 'Stacks[].Outputs' -``` ## Bringing to the next level diff --git a/samcli/local/init/templates/cookiecutter-aws-sam-hello-java-gradle/{{cookiecutter.project_name}}/README.md b/samcli/local/init/templates/cookiecutter-aws-sam-hello-java-gradle/{{cookiecutter.project_name}}/README.md index a1729ec9d0..f1b9712296 100644 --- a/samcli/local/init/templates/cookiecutter-aws-sam-hello-java-gradle/{{cookiecutter.project_name}}/README.md +++ b/samcli/local/init/templates/cookiecutter-aws-sam-hello-java-gradle/{{cookiecutter.project_name}}/README.md @@ -23,44 +23,26 @@ The Serverless Application Model Command Line Interface (SAM CLI) is an extensio To use the SAM CLI, you need the following tools. -* AWS CLI - [Install the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html) and [configure it with your AWS credentials]. * SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) * Java8 - [Install the Java SE Development Kit 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) * Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community) -The SAM CLI uses an Amazon S3 bucket to store your application's deployment artifacts. If you don't have a bucket suitable for this purpose, create one. Replace `BUCKET_NAME` in the commands in this section with a unique bucket name. +To build and deploy your application for the first time, run the following in your shell: ```bash -{{ cookiecutter.project_name }}$ aws s3 mb s3://BUCKET_NAME +sam build +sam deploy --guided ``` -To prepare the application for deployment, use the `sam package` command. +The first command will build the source of your application. The second command will package and deploy your application to AWS, with a series of prompts: -```bash -{{ cookiecutter.project_name }}$ sam package \ - --output-template-file packaged.yaml \ - --s3-bucket BUCKET_NAME -``` - -The SAM CLI creates deployment packages, uploads them to the S3 bucket, and creates a new version of the template that refers to the artifacts in the bucket. +* **Stack Name**: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name. +* **AWS Region**: The AWS region you want to deploy your app to. +* **Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes. +* **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modified IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command. +* **Save arguments to samconfig.toml**: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application. -To deploy the application, use the `sam deploy` command. - -```bash -{{ cookiecutter.project_name }}$ sam deploy \ - --template-file packaged.yaml \ - --stack-name {{ cookiecutter.project_name }} \ - --capabilities CAPABILITY_IAM -``` - -After deployment is complete you can run the following command to retrieve the API Gateway Endpoint URL: - -```bash -{{ cookiecutter.project_name }}$ aws cloudformation describe-stacks \ - --stack-name {{ cookiecutter.project_name }} \ - --query 'Stacks[].Outputs[?OutputKey==`HelloWorldApi`]' \ - --output table -``` +You can find your API Gateway Endpoint URL in the output values displayed after deployment. ## Use the SAM CLI to build and test locally @@ -124,11 +106,10 @@ HelloWorldFunction$ gradle test ## Cleanup -To delete the sample application and the bucket that you created, use the AWS CLI. +To delete the sample application that you created, use the AWS CLI. Assuming you used your project name for the stack name, you can run the following: ```bash -{{ cookiecutter.project_name }}$ aws cloudformation delete-stack --stack-name {{ cookiecutter.project_name }} -{{ cookiecutter.project_name }}$ aws s3 rb s3://BUCKET_NAME +aws cloudformation delete-stack --stack-name {{ cookiecutter.project_name }} ``` ## Resources diff --git a/samcli/local/init/templates/cookiecutter-aws-sam-hello-java-maven/{{cookiecutter.project_name}}/README.md b/samcli/local/init/templates/cookiecutter-aws-sam-hello-java-maven/{{cookiecutter.project_name}}/README.md index 5b46ee17f5..34c8f025f2 100644 --- a/samcli/local/init/templates/cookiecutter-aws-sam-hello-java-maven/{{cookiecutter.project_name}}/README.md +++ b/samcli/local/init/templates/cookiecutter-aws-sam-hello-java-maven/{{cookiecutter.project_name}}/README.md @@ -23,45 +23,27 @@ The Serverless Application Model Command Line Interface (SAM CLI) is an extensio To use the SAM CLI, you need the following tools. -* AWS CLI - [Install the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html) and [configure it with your AWS credentials]. * SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) * Java8 - [Install the Java SE Development Kit 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) * Maven - [Install Maven](https://maven.apache.org/install.html) * Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community) -The SAM CLI uses an Amazon S3 bucket to store your application's deployment artifacts. If you don't have a bucket suitable for this purpose, create one. Replace `BUCKET_NAME` in the commands in this section with a unique bucket name. +To build and deploy your application for the first time, run the following in your shell: ```bash -{{ cookiecutter.project_name }}$ aws s3 mb s3://BUCKET_NAME +sam build +sam deploy --guided ``` -To prepare the application for deployment, use the `sam package` command. +The first command will build the source of your application. The second command will package and deploy your application to AWS, with a series of prompts: -```bash -{{ cookiecutter.project_name }}$ sam package \ - --output-template-file packaged.yaml \ - --s3-bucket BUCKET_NAME -``` - -The SAM CLI creates deployment packages, uploads them to the S3 bucket, and creates a new version of the template that refers to the artifacts in the bucket. +* **Stack Name**: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name. +* **AWS Region**: The AWS region you want to deploy your app to. +* **Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes. +* **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modified IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command. +* **Save arguments to samconfig.toml**: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application. -To deploy the application, use the `sam deploy` command. - -```bash -{{ cookiecutter.project_name }}$ sam deploy \ - --template-file packaged.yaml \ - --stack-name {{ cookiecutter.project_name }} \ - --capabilities CAPABILITY_IAM -``` - -After deployment is complete you can run the following command to retrieve the API Gateway Endpoint URL: - -```bash -{{ cookiecutter.project_name }}$ aws cloudformation describe-stacks \ - --stack-name {{ cookiecutter.project_name }} \ - --query 'Stacks[].Outputs[?OutputKey==`HelloWorldApi`]' \ - --output table -``` +You can find your API Gateway Endpoint URL in the output values displayed after deployment. ## Use the SAM CLI to build and test locally @@ -125,11 +107,10 @@ HelloWorldFunction$ mvn test ## Cleanup -To delete the sample application and the bucket that you created, use the AWS CLI. +To delete the sample application that you created, use the AWS CLI. Assuming you used your project name for the stack name, you can run the following: ```bash -{{ cookiecutter.project_name }}$ aws cloudformation delete-stack --stack-name {{ cookiecutter.project_name }} -{{ cookiecutter.project_name }}$ aws s3 rb s3://BUCKET_NAME +aws cloudformation delete-stack --stack-name {{ cookiecutter.project_name }} ``` ## Resources diff --git a/samcli/local/init/templates/cookiecutter-aws-sam-hello-nodejs/{{cookiecutter.project_name}}/README.md b/samcli/local/init/templates/cookiecutter-aws-sam-hello-nodejs/{{cookiecutter.project_name}}/README.md index baab85559a..aa68a714ed 100644 --- a/samcli/local/init/templates/cookiecutter-aws-sam-hello-nodejs/{{cookiecutter.project_name}}/README.md +++ b/samcli/local/init/templates/cookiecutter-aws-sam-hello-nodejs/{{cookiecutter.project_name}}/README.md @@ -23,44 +23,26 @@ The Serverless Application Model Command Line Interface (SAM CLI) is an extensio To use the SAM CLI, you need the following tools. -* AWS CLI - [Install the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html) and [configure it with your AWS credentials]. * SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) * Node.js - [Install Node.js 10](https://nodejs.org/en/), including the NPM package management tool. * Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community) -The SAM CLI uses an Amazon S3 bucket to store your application's deployment artifacts. If you don't have a bucket suitable for this purpose, create one. Replace `BUCKET_NAME` in the commands in this section with a unique bucket name. +To build and deploy your application for the first time, run the following in your shell: ```bash -{{ cookiecutter.project_name }}$ aws s3 mb s3://BUCKET_NAME +sam build +sam deploy --guided ``` -To prepare the application for deployment, use the `sam package` command. +The first command will build the source of your application. The second command will package and deploy your application to AWS, with a series of prompts: -```bash -{{ cookiecutter.project_name }}$ sam package \ - --output-template-file packaged.yaml \ - --s3-bucket BUCKET_NAME -``` - -The SAM CLI creates deployment packages, uploads them to the S3 bucket, and creates a new version of the template that refers to the artifacts in the bucket. +* **Stack Name**: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name. +* **AWS Region**: The AWS region you want to deploy your app to. +* **Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes. +* **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modified IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command. +* **Save arguments to samconfig.toml**: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application. -To deploy the application, use the `sam deploy` command. - -```bash -{{ cookiecutter.project_name }}$ sam deploy \ - --template-file packaged.yaml \ - --stack-name {{ cookiecutter.project_name }} \ - --capabilities CAPABILITY_IAM -``` - -After deployment is complete you can run the following command to retrieve the API Gateway Endpoint URL: - -```bash -{{ cookiecutter.project_name }}$ aws cloudformation describe-stacks \ - --stack-name {{ cookiecutter.project_name }} \ - --query 'Stacks[].Outputs[?OutputKey==`HelloWorldApi`]' \ - --output table -``` +You can find your API Gateway Endpoint URL in the output values displayed after deployment. ## Use the SAM CLI to build and test locally @@ -125,15 +107,14 @@ hello-world$ npm run test ## Cleanup -To delete the sample application and the bucket that you created, use the AWS CLI. +To delete the sample application that you created, use the AWS CLI. Assuming you used your project name for the stack name, you can run the following: ```bash -{{ cookiecutter.project_name }}$ aws cloudformation delete-stack --stack-name {{ cookiecutter.project_name }} -{{ cookiecutter.project_name }}$ aws s3 rb s3://BUCKET_NAME +aws cloudformation delete-stack --stack-name {{ cookiecutter.project_name }} ``` ## Resources See the [AWS SAM developer guide](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html) for an introduction to SAM specification, the SAM CLI, and serverless application concepts. -Next, you can use AWS Serverless Application Repository to deploy ready to use Apps that go beyond hello world samples and learn how authors developed their applications: [AWS Serverless Application Repository main page](https://aws.amazon.com/serverless/serverlessrepo/) \ No newline at end of file +Next, you can use AWS Serverless Application Repository to deploy ready to use Apps that go beyond hello world samples and learn how authors developed their applications: [AWS Serverless Application Repository main page](https://aws.amazon.com/serverless/serverlessrepo/) diff --git a/samcli/local/init/templates/cookiecutter-aws-sam-hello-python/{{cookiecutter.project_name}}/README.md b/samcli/local/init/templates/cookiecutter-aws-sam-hello-python/{{cookiecutter.project_name}}/README.md index a12489cb39..0fe6ea9a37 100644 --- a/samcli/local/init/templates/cookiecutter-aws-sam-hello-python/{{cookiecutter.project_name}}/README.md +++ b/samcli/local/init/templates/cookiecutter-aws-sam-hello-python/{{cookiecutter.project_name}}/README.md @@ -23,7 +23,6 @@ The Serverless Application Model Command Line Interface (SAM CLI) is an extensio To use the SAM CLI, you need the following tools. -* AWS CLI - [Install the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html) and [configure it with your AWS credentials]. * SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) {%- if cookiecutter.runtime == 'python2.7' %} * [Python 2.7 installed](https://www.python.org/downloads/) @@ -32,39 +31,22 @@ To use the SAM CLI, you need the following tools. {%- endif %} * Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community) -The SAM CLI uses an Amazon S3 bucket to store your application's deployment artifacts. If you don't have a bucket suitable for this purpose, create one. Replace `BUCKET_NAME` in the commands in this section with a unique bucket name. +To build and deploy your application for the first time, run the following in your shell: ```bash -{{ cookiecutter.project_name }}$ aws s3 mb s3://BUCKET_NAME +sam build +sam deploy --guided ``` -To prepare the application for deployment, use the `sam package` command. +The first command will build the source of your application. The second command will package and deploy your application to AWS, with a series of prompts: -```bash -{{ cookiecutter.project_name }}$ sam package \ - --output-template-file packaged.yaml \ - --s3-bucket BUCKET_NAME -``` - -The SAM CLI creates deployment packages, uploads them to the S3 bucket, and creates a new version of the template that refers to the artifacts in the bucket. +* **Stack Name**: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name. +* **AWS Region**: The AWS region you want to deploy your app to. +* **Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes. +* **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modified IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command. +* **Save arguments to samconfig.toml**: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application. -To deploy the application, use the `sam deploy` command. - -```bash -{{ cookiecutter.project_name }}$ sam deploy \ - --template-file packaged.yaml \ - --stack-name {{ cookiecutter.project_name }} \ - --capabilities CAPABILITY_IAM -``` - -After deployment is complete you can run the following command to retrieve the API Gateway Endpoint URL: - -```bash -{{ cookiecutter.project_name }}$ aws cloudformation describe-stacks \ - --stack-name {{ cookiecutter.project_name }} \ - --query 'Stacks[].Outputs[?OutputKey==`HelloWorldApi`]' \ - --output table -``` +You can find your API Gateway Endpoint URL in the output values displayed after deployment. ## Use the SAM CLI to build and test locally @@ -128,11 +110,10 @@ Tests are defined in the `tests` folder in this project. Use PIP to install the ## Cleanup -To delete the sample application and the bucket that you created, use the AWS CLI. +To delete the sample application that you created, use the AWS CLI. Assuming you used your project name for the stack name, you can run the following: ```bash -{{ cookiecutter.project_name }}$ aws cloudformation delete-stack --stack-name {{ cookiecutter.project_name }} -{{ cookiecutter.project_name }}$ aws s3 rb s3://BUCKET_NAME +aws cloudformation delete-stack --stack-name {{ cookiecutter.project_name }} ``` ## Resources diff --git a/samcli/local/init/templates/cookiecutter-aws-sam-hello-ruby/{{cookiecutter.project_name}}/README.md b/samcli/local/init/templates/cookiecutter-aws-sam-hello-ruby/{{cookiecutter.project_name}}/README.md index 8c426579f1..0ffe88b084 100644 --- a/samcli/local/init/templates/cookiecutter-aws-sam-hello-ruby/{{cookiecutter.project_name}}/README.md +++ b/samcli/local/init/templates/cookiecutter-aws-sam-hello-ruby/{{cookiecutter.project_name}}/README.md @@ -23,44 +23,26 @@ The Serverless Application Model Command Line Interface (SAM CLI) is an extensio To use the SAM CLI, you need the following tools. -* AWS CLI - [Install the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html) and [configure it with your AWS credentials]. * SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) * Ruby - [Install Ruby 2.5](https://www.ruby-lang.org/en/documentation/installation/) * Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community) -The SAM CLI uses an Amazon S3 bucket to store your application's deployment artifacts. If you don't have a bucket suitable for this purpose, create one. Replace `BUCKET_NAME` in the commands in this section with a unique bucket name. +To build and deploy your application for the first time, run the following in your shell: ```bash -{{ cookiecutter.project_name }}$ aws s3 mb s3://BUCKET_NAME +sam build +sam deploy --guided ``` -To prepare the application for deployment, use the `sam package` command. +The first command will build the source of your application. The second command will package and deploy your application to AWS, with a series of prompts: -```bash -{{ cookiecutter.project_name }}$ sam package \ - --output-template-file packaged.yaml \ - --s3-bucket BUCKET_NAME -``` - -The SAM CLI creates deployment packages, uploads them to the S3 bucket, and creates a new version of the template that refers to the artifacts in the bucket. +* **Stack Name**: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name. +* **AWS Region**: The AWS region you want to deploy your app to. +* **Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes. +* **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modified IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command. +* **Save arguments to samconfig.toml**: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application. -To deploy the application, use the `sam deploy` command. - -```bash -{{ cookiecutter.project_name }}$ sam deploy \ - --template-file packaged.yaml \ - --stack-name {{ cookiecutter.project_name }} \ - --capabilities CAPABILITY_IAM -``` - -After deployment is complete you can run the following command to retrieve the API Gateway Endpoint URL: - -```bash -{{ cookiecutter.project_name }}$ aws cloudformation describe-stacks \ - --stack-name {{ cookiecutter.project_name }} \ - --query 'Stacks[].Outputs[?OutputKey==`HelloWorldApi`]' \ - --output table -``` +You can find your API Gateway Endpoint URL in the output values displayed after deployment. ## Use the SAM CLI to build and test locally @@ -123,11 +105,10 @@ Tests are defined in the `tests` folder in this project. ## Cleanup -To delete the sample application and the bucket that you created, use the AWS CLI. +To delete the sample application that you created, use the AWS CLI. Assuming you used your project name for the stack name, you can run the following: ```bash -{{ cookiecutter.project_name }}$ aws cloudformation delete-stack --stack-name {{ cookiecutter.project_name }} -{{ cookiecutter.project_name }}$ aws s3 rb s3://BUCKET_NAME +aws cloudformation delete-stack --stack-name {{ cookiecutter.project_name }} ``` ## Resources