.NET Core CI/CD on the AWS Cloud
Quick Start Reference Deployment

December 2020
Rajeswari Malladi and Dave May, AWS Quick Start team
Visit our GitHub repository for source files and to post feedback, report bugs, or submit feature ideas for this Quick Start. |
This Quick Start was created by Amazon Web Services (AWS). Quick Starts are automated reference deployments that use AWS CloudFormation templates to deploy key technologies on AWS, following AWS best practices.
Overview
This guide provides instructions for deploying the .NET Core CI/CD Quick Start reference architecture on the AWS Cloud.
This Quick Start is for developers who are looking to implement an automated continuous integration and continuous delivery (CI/CD) pipeline for their .NET Core applications.
.NET Core CI/CD on AWS
The .NET Core CI/CD environment manages application updates using AWS CodePipeline, AWS CodeBuild, and AWS CodeDeploy. The CI/CD pipeline polls a GitHub repository for updates. Whenever code is modified within the configured repository branch, the pipeline fetches the latest source code and automatically builds the application. It then deploys the application to an AWS Elastic Beanstalk environment running Amazon Linux 2.
This scalable deployment helps you deliver features and updates rapidly and reliably. You have no build servers to manage, and you pay only for what you use.
AWS costs
You are responsible for the cost of the AWS services and any third-party licenses used while running this Quick Start. There is no additional cost for using the Quick Start.
The AWS CloudFormation templates for Quick Starts include configuration parameters that you can customize. Some of the settings, such as the instance type, affect the cost of deployment. For cost estimates, see the pricing pages for each AWS service you use. Prices are subject to change.
After you deploy the Quick Start, create AWS Cost and Usage Reports to deliver billing metrics to an Amazon Simple Storage Service (Amazon S3) bucket in your account. These reports provide cost estimates based on usage throughout each month and aggregate the data at the end of the month. For more information, see What are AWS Cost and Usage Reports? |
Software licenses
There are no licensing requirements for this Quick Start.
Architecture
Deploying this Quick Start with default parameters builds the following .NET Core CI/CD environment in the AWS Cloud.

As shown in Figure 1, the Quick Start sets up the following:
-
An S3 bucket for holding artifacts.
-
An Elastic Beanstalk environment that acts as the target when the application’s latest build package is deployed.
-
A CI/CD pipeline with source, build, and deploy stages.
The source stage invokes CodePipeline every time the code changes in the configured GitHub repository branch. This stage configures GitHub, which integrates the application source code via webhooks. It then fetches the latest GitHub code and places it in an S3 bucket in the Source Artifacts
directory.
The build stage invokes CodeBuild, which fetches the source code from the S3 bucket. The CodeBuild-provided Amazon Linux 2 Docker image for .NET Core compiles the latest source code using the steps provided in the associated BuildSpec.yml
file. The resulting build package is placed in the Build Artifacts
directory in the S3 bucket.
The deploy stage invokes CodeDeploy to fetch the build package from the S3 bucket and deploy it to the Elastic Beanstalk environment.
Planning the deployment
Specialized knowledge
This deployment requires a moderate level of familiarity with AWS services. If you’re new to AWS, see Getting Started Resource Center and AWS Training and Certification. These sites provide materials for learning how to design, deploy, and operate your infrastructure and applications on the AWS Cloud.
This Quick Start also assumes familiarity with the .NET Core development platform and its support on Linux.
AWS account
If you don’t already have an AWS account, create one at https://aws.amazon.com by following the on-screen instructions. Part of the sign-up process involves receiving a phone call and entering a PIN using the phone keypad.
Your AWS account is automatically signed up for all AWS services. You are charged only for the services you use.
Technical requirements
Before you launch the Quick Start, review the following information and ensure that your account is properly configured. Otherwise, deployment might fail.
Resource quotas
If necessary, request service quota increases for the following resources. You might request quota increases to avoid exceeding the default limits for any resources that are shared across multiple deployments. The Service Quotas console displays your usage and quotas for some aspects of some services. For more information, see What is Service Quotas? and AWS service quotas.
Resource | This deployment uses |
---|---|
AWS Identity and Access Management (IAM) roles |
3 |
S3 buckets |
2 |
Elastic Beanstalk environments |
1 |
Elastic Beanstalk applications |
1 |
CodeBuild projects |
1 |
CodePipeline pipelines |
1 |
Supported Regions
This Quick Start supports the following Regions:
-
us-east-1, US East (N. Virginia)
-
us-west-2, US West (Oregon)
-
eu-west-1, EU West (Europe, Ireland)
Certain Regions are available on an opt-in basis. For more information, see Managing AWS Regions. |
IAM permissions
Before launching the Quick Start, you must sign in to the AWS Management Console with IAM permissions for the resources that the templates deploy. The AdministratorAccess managed policy within IAM provides sufficient permissions, although your organization may choose to use a custom policy with more restrictions. For more information, see AWS managed policies for job functions.
Deployment options
This Quick Start provides one deployment option: provision the CI/CD assets in your existing AWS infrastructure.
Deployment steps
Sign in to your AWS account
-
Sign in to your AWS account at https://aws.amazon.com with an IAM user role that has the necessary permissions. For details, see Planning the deployment earlier in this guide.
-
Make sure that your AWS account is configured correctly, as discussed in the Technical requirements section.
Fork the repository and obtain inputs
The .NET Core CI/CD GitHub repository includes the following:
-
The AWS CloudFormation template (
quickstart-dotnetcore-cicd.template.yml
) -
The file used in CodeBuild (
buildspec.yml
) -
Source code for a sample web application (
WebApplicationSample
)
Fork this GitHub repository. Then, obtain the inputs that you will need during deployment:
Input name | Input value |
---|---|
GitHubOAuthToken |
1. Go to https://github.com/settings/tokens/new. 2. Enter .NET Core CI/CD in the Note box. 3. Select the repo check box. 4. Select the admin:repo_hook check box. 5. Choose Generate token. |
GitHubOwner |
Your GitHub login user name. |
GitHubRepositoryName |
The name of your forked repository. |
GitHubBranchName |
The branch name that you want to use in your fork to initiate the AWS CodePipeline. |
Launch the Quick Start
You are responsible for the cost of the AWS services used while running this Quick Start reference deployment. There is no additional cost for using this Quick Start. For full details, see the pricing pages for each AWS service used by this Quick Start. Prices are subject to change. |
Each deployment takes about 10 minutes to complete.
-
Sign in to your AWS account, and launch the AWS CloudFormation template by choosing the following "Deploy" link.
-
Check the AWS Region that’s displayed in the upper-right corner of the navigation bar, and change it if necessary. This is where the network infrastructure for .NET Core CI/CD is built. The template is launched in the us-east-1 Region by default. For other choices, see Supported Regions earlier in this guide.
-
On the Create stack page, keep the default setting for the template URL, and then choose Next.
-
On the Specify stack details page, change the stack name if needed. Review the parameters for the template. Provide values for the parameters that require input. For all other parameters, review the default settings and customize them as necessary. For details on each parameter, see the Parameter reference section of this guide. When you finish reviewing and customizing the parameters, choose Next.
+
+ . On the Configure stack options page, you can specify tags (key-value pairs) for resources in your stack and set advanced options. When you’re finished, choose Next. . On the Review page, review and confirm the template settings. Under Capabilities, select the two check boxes to acknowledge that the template creates IAM resources and might require the ability to automatically expand macros. . Choose Create stack to deploy the stack. . Monitor the status of the stack. When the status is CREATE_COMPLETE, the .NET Core CI/CD deployment is ready. . Use the values displayed in the Outputs tab for the stack, as shown in Figure 2, to view the created resources.
Test the deployment
As shown in Figure 3, your deployment has created two AWS CloudFormation stacks: an Elastic Beanstalk stack with a randomly generated name and a CodePipeline stack that was named when you deployed the Quick Start. (The name of the CodePipeline stack also appears under the Outputs tab, as shown in Figure 2).
Test the deployment as follows:
-
Open the CodePipeline console, and view your created pipelines. Verify that the status of the pipeline created in this deployment is Succeeded, as shown in Figure 4.
-
Navigate to the Outputs tab for the Elastic Beanstalk CloudFormation stack, as shown in Figure 5. Choose the load-balancer URL, and verify that the webpage loads.
-
Navigate to the Elastic Beanstalk environment created by AWS CloudFormation, choose the URL for the application, and confirm that your sample application is deployed from GitHub.
-
Modify the sample application code of your forked GitHub repository, and check in the changes.
-
Verify that CodePipeline starts the CI/CD process and deploys your latest code changes to Elastic Beanstalk.
FAQ
Q. I encountered a CREATE_FAILED error when I launched the Quick Start.
A. If AWS CloudFormation fails to create the stack, relaunch the template with Rollback on failure set to Disabled. This setting is under Advanced in the AWS CloudFormation console on the Configure stack options page. With this setting, you retain the state of the stack and keep the assets running so that you can troubleshoot the issue.
When you set Rollback on failure to Disabled, you continue to incur AWS charges for this stack. Delete the stack when you finish troubleshooting. |
For more information, see Troubleshooting AWS CloudFormation.
Q. I encountered a size-limitation error when I deployed the AWS CloudFormation templates.
A. Launch the Quick Start templates from the links in this guide or from another S3 bucket. If you deploy the templates from a local copy on your computer or from a location other than an S3 bucket, you might encounter template-size limitations. For more information, see AWS CloudFormation quotas.
Parameter reference
Unless you are customizing the Quick Start templates for your own deployment projects, we recommend that you keep the default settings for the parameters labeled Quick Start S3 bucket name , Quick Start S3 bucket
Region , and Quick Start S3 key prefix . Changing these parameter settings automatically updates code references to point to a new Quick Start location. For more information, see the AWS Quick Start Contributor’s Guide.
|
Parameters for deploying the CI/CD pipeline
Parameter label (name) | Default value | Description |
---|---|---|
GitHub repository name
( |
|
Name of the GitHub repository that hosts the web application. |
GitHub branch name
( |
|
Name of the GitHub branch that the CI/CD pipeline will pull from. |
GitHub owner user name
( |
|
User name for accessing the GitHub repository. |
GitHub OAuth token
( |
|
OAuth token for accessing the GitHub repository. |
Parameter label (name) | Default value | Description |
---|---|---|
Elastic Beanstalk platform version
( |
|
Platform version to use for the .NET Core Elastic Beanstalk environment. Enter the latest version. To find the latest version, go to https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.dotnetlinux. |
Parameter label (name) | Default value | Description |
---|---|---|
CodeBuild image version
( |
|
Docker image version to use for CodeBuild. Enter the latest version. To find the latest version, go to https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html. |
Send us feedback
To post feedback, submit feature ideas, or report bugs, use the Issues section of the GitHub repository for this Quick Start. To submit code, see the Quick Start Contributor’s Guide.
Quick Start reference deployments
See the AWS Quick Start home page.
GitHub repository
Visit our GitHub repository to download the templates and scripts for this Quick Start, to post your comments, and to share your customizations with others.
Notices
This document is provided for informational purposes only. It represents AWS’s current product offerings and practices as of the date of issue of this document, which are subject to change without notice. Customers are responsible for making their own independent assessment of the information in this document and any use of AWS’s products or services, each of which is provided “as is” without warranty of any kind, whether expressed or implied. This document does not create any warranties, representations, contractual commitments, conditions, or assurances from AWS, its affiliates, suppliers, or licensors. The responsibilities and liabilities of AWS to its customers are controlled by AWS agreements, and this document is not part of, nor does it modify, any agreement between AWS and its customers.
The software included with this paper is licensed under the Apache License, version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at http://aws.amazon.com/apache2.0/ or in the accompanying "license" file. This code is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expressed or implied. See the License for specific language governing permissions and limitations.