### Initialize Environment with Existing Resources Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/developing/custom-environment-resources.en.md Use this command to initiate environment setup when you want to import existing VPC resources instead of creating new ones. The guided experience prompts for environment name and credential selection, then offers options to import resources. ```bash $ copilot env init What is your environment's name? env-name Which credentials would you like to use to create name? [profile default] Would you like to use the default configuration for a new environment? - A new VPC with 2 AZs, 2 public subnets and 2 private subnets - A new ECS Cluster - New IAM Roles to manage services and jobs in your environment [Use arrows to move, type to filter] Yes, use default. Yes, but I'd like configure the default resources (CIDR ranges). > No, I'd like to import existing resources (VPC, subnets). ``` -------------------------------- ### Create Pipeline Interactively Source: https://context7.com/aws/copilot-cli/llms.txt Initialize a CI/CD pipeline manifest interactively. The command will guide you through the setup process. ```bash copilot pipeline init ``` -------------------------------- ### Create a new application named 'my-app' Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/app-init.en.md This example shows how to initialize a new application with a specific name. ```bash $ copilot app init my-app ``` -------------------------------- ### Guided Storage Initialization Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/developing/storage.en.md Initiates a guided experience for setting up storage resources like S3 buckets, DynamoDB tables, or Aurora Serverless clusters within Copilot. ```bash copilot storage init -t S3 ``` ```bash copilot storage init -t DynamoDB ``` ```bash copilot storage init -t Aurora ``` -------------------------------- ### List Copilot Projects Source: https://github.com/aws/copilot-cli/wiki/project-ls-command Use this command to view all your existing Copilot projects. No setup or imports are required beyond having the CLI installed. ```bash $ ecs-preview project ls ``` -------------------------------- ### Install Zsh Completion Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/completion.en.md To install zsh completion, source the output of the completion command. For persistent completion, redirect the output to a file in your fpath. ```console $ source <(copilot completion zsh) ``` ```console $ copilot completion zsh > "${fpath[1]}/_copilot" ``` -------------------------------- ### Sample Pipeline Manifests Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/manifest/pipeline.en.md Examples of Copilot pipeline manifests demonstrating different configurations. ```APIDOC ## Sample Continuous Delivery Pipeline Manifests ### Release Workloads ```yaml # The "app-pipeline" will deploy all the services and jobs in the user/repo # to the "test" and "prod" environments. name: app-pipeline source: provider: GitHub properties: branch: main repository: https://github.com/user/repo # Optional: specify the name of an existing CodeStar Connections connection. # connection_name: a-connection build: image: aws/codebuild/amazonlinux2-x86_64-standard:5.0 # additional_policy: # Add additional permissions while building your container images and templates. stages: - # By default all workloads are deployed concurrently within a stage. name: test pre_deployments: db_migration: buildspec: ./buildspec.yml test_commands: - make integ-test - echo "woo! Tests passed" - name: prod requires_approval: true ``` ### Control Order of Deployments ```yaml # Alternatively, you can control the order of stack deployments in a stage. # See https://aws.github.io/copilot-cli/blogs/release-v118/#controlling-order-of-deployments-in-a-pipeline name: app-pipeline source: provider: Bitbucket properties: branch: main repository: https://bitbucket.org/user/repo stages: - name: test deployments: orders: warehouse: frontend: depends_on: [orders, warehouse] - name: prod require_approval: true deployments: orders: warehouse: frontend: depends_on: [orders, warehouse] ``` ### Release Environments ```yaml # Environment manifests changes can also be released with a pipeline. name: env-pipeline source: provider: CodeCommit properties: branch: main repository: https://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo stages: - name: test deployments: deploy-env: template_path: infrastructure/test.env.yml template_config: infrastructure/test.env.params.json stack_name: app-test - name: prod deployments: deploy-prod: template_path: infrastructure/prod.env.yml template_config: infrastructure/prod.env.params.json stack_name: app-prod ``` ``` -------------------------------- ### Copilot CLI Initialization Success Example Source: https://github.com/aws/copilot-cli/blob/mainline/STYLE_GUIDE.md This example demonstrates a successful Copilot CLI command execution, including a success message and recommended follow-up actions. ```bash $ copilot svc init -n frontend -t "Load Balanced Web Service" -d ./frontend/Dockerfile ✔ Success! Wrote the manifest for service frontend at 'copilot/frontend/manifest.yml' Recommended follow-up actions: - Update your manifest copilot/frontend/manifest.yml to change the defaults. ``` -------------------------------- ### Copilot CLI Initialization Failure Example Source: https://github.com/aws/copilot-cli/blob/mainline/STYLE_GUIDE.md This example shows how a Copilot CLI command indicates a missing prerequisite, suggesting the user run `app init` first. ```bash $ copilot svc init ✘ could not find an application attached to this workspace, please run `app init` first ``` -------------------------------- ### Clone Sample Application Repository Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/getting-started/first-app-tutorial.en.md Use this command to clone the sample application repository and navigate into its directory. Ensure you have Git installed. ```bash $ git clone https://github.com/aws-samples/aws-copilot-sample-service example $ cd example ``` -------------------------------- ### Flag Usage Example with Short Names Source: https://github.com/aws/copilot-cli/blob/mainline/STYLE_GUIDE.md Illustrates how to use flags with both long and short names for initializing an environment, providing options for environment name and application name. ```bash env init -n MyEnv -a MyApp ``` -------------------------------- ### Bulk Command Argument Example Source: https://github.com/aws/copilot-cli/blob/mainline/STYLE_GUIDE.md Shows an example of a bulk command that accepts multiple arguments of the same type, where order does not matter, such as deleting multiple environments. ```bash copilot env delete test-pdx test-iad ``` -------------------------------- ### Initialize a Load Balanced Web Service Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/svc-init.en.md Example of initializing a specific service type, a 'Load Balanced Web Service', with a given name and Dockerfile path. ```console $ copilot svc init --name frontend --svc-type "Load Balanced Web Service" --dockerfile ./frontend/Dockerfile ``` -------------------------------- ### Example env file content Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/developing/environment-variables.en.md An example of an environment file, where each line defines a key-value pair for environment variables. Comments are ignored. ```env #This is a comment and will be ignored LOG_LEVEL=debug LOG_INFO=all ``` -------------------------------- ### Example Folder Structure Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/developing/addons/package.en.md Illustrates the expected file and directory structure for local artifacts when using Copilot CLI's upload feature. ```bash . ├── copilot │ └── example-service │ ├── addons │ │ └── lambda.yml │ └── manifest.yml └── lambdas └── example └── index.js ``` -------------------------------- ### Copilot Environment Initialization Prompt Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/credentials.en.md Example of the prompt shown during `copilot env init` where you can select credentials for creating an environment. Options include temporary credentials or named profiles. ```bash $ copilot env init Name: prod-iad Which credentials would you like to use to create prod-iad? > Enter temporary credentials > [profile default] > [profile test] > [profile prod-iad] > [profile prod-pdx] ``` -------------------------------- ### Sample Static Site Manifest Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/manifest/static-site.en.md A basic example of a static site manifest, demonstrating the 'name', 'type', 'http' alias, and 'files' configurations. ```yaml name: example type: Static Site http: alias: 'example.com' files: - source: src/someDirectory recursive: true - source: someFile.html # You can override any of the values defined above by environment. # environments: # test: # files: # - source: './blob' # destination: 'assets' # recursive: true # exclude: '*' # reinclude: # - '*.txt' # - '*.png' ``` -------------------------------- ### Importing Existing VPC Subnets Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/manifest/environment.en.md Example of configuring public subnets when importing an existing VPC. ```yaml network: vpc: id: 'vpc-12345' subnets: public: - id: 'subnet-11111' - id: 'subnet-22222' ``` -------------------------------- ### Open Copilot Docs Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/docs.en.md Use this command to open the Copilot documentation in your default web browser. No setup is required. ```console $ copilot docs [flags] ``` -------------------------------- ### Initialize a New Environment Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/concepts/environments.en.md Run this command to start the process of creating a new environment for your application. Copilot will prompt you for the environment name and the AWS profile to use. ```bash copilot env init ``` -------------------------------- ### Argument Usage Example Source: https://github.com/aws/copilot-cli/blob/mainline/STYLE_GUIDE.md Demonstrates the use of a single, required positional argument for a command, such as initializing a new environment. ```bash app init [name] ``` -------------------------------- ### Install Fish Completion on Linux Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/completion.en.md To enable fish shell completion, source the output of the completion command and redirect it to the fish completions directory. ```console $ source <(copilot completion fish) ``` ```console $ copilot completion fish > ~/.config/fish/completions/copilot.fish ``` -------------------------------- ### Initialize a test environment with default configuration Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/env-init.en.md Use this command to create a test environment using your default AWS profile and default configuration settings. This is useful for quick setup and testing. ```console $ copilot env init --name test --profile default --default-config ``` -------------------------------- ### Initialize a new Copilot application Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/init.en.md Run this command within a directory containing your Dockerfile to start a new application. The CLI will prompt for details about your application. ```console $ copilot init ``` -------------------------------- ### Repository Layout Example Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/blogs/release-v118.en.md Illustrates a monorepo structure where Copilot services (`frontend`, `orders`, `warehouse`) reside in separate directories, each with its own manifest.yml. ```text copilot ├── frontend │ └── manifest.yml ├── orders │ └── manifest.yml └── warehouse └── manifest.yml ``` -------------------------------- ### Initialize and Deploy Local Workloads Source: https://context7.com/aws/copilot-cli/llms.txt Initialize and deploy all local workloads to a specified environment. Use '--init-wkld' and '--deploy-env'. ```bash copilot deploy --all --init-wkld --deploy-env -e prod ``` -------------------------------- ### Display Copilot CLI version Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/version.en.md Use this command to check the installed version of the Copilot CLI and the operating system it was built for. No setup is required. ```console $ copilot version [flags] ``` -------------------------------- ### List Copilot Applications Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/app-ls.en.md Use this command to list all Copilot applications in your account and region. No additional setup is required beyond having the Copilot CLI installed and configured. ```console $ copilot app ls ``` -------------------------------- ### Initialize and Deploy Sample Application Source: https://github.com/aws/copilot-cli/blob/mainline/README.md This command initializes a new Copilot application, creates a load-balanced web service using a Dockerfile, and deploys it to AWS Fargate. Ensure AWS CLI is configured. ```bash git clone git@github.com:aws-samples/aws-copilot-sample-service.git demo-app cd demo-app copilot init --app demo \ --name api \ --type 'Load Balanced Web Service' \ --dockerfile './Dockerfile' \ --deploy ``` -------------------------------- ### Initialize a New Service Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/svc-init.en.md Run this command to create a new service. It will prompt for necessary details and set up the service's directory and configuration. ```console $ copilot svc init ``` -------------------------------- ### Call Service Using Service Connect Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/developing/svc-to-svc-communication.en.md Example of making an HTTP GET request to the 'api' service from the 'front-end' service using the default Service Connect endpoint. ```go // Calling the "api" service from the "front-end" service. resp, err := http.Get("http://api/") ``` -------------------------------- ### Initialize an environment with imported VPC resources Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/env-init.en.md This example demonstrates initializing an environment by importing existing AWS resources. Specify the VPC ID, public and private subnet IDs, and ACM certificate ARNs to reuse your current infrastructure. ```console $ copilot env init --import-vpc-id vpc-099c32d2b98cdcf47 \ --import-public-subnets subnet-013e8b691862966cf,subnet-014661ebb7ab8681a \ --import-private-subnets subnet-055fafef48fb3c547,subnet-00c9e76f288363e7f \ --import-cert-arns arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012 ``` -------------------------------- ### Install GnuPG on macOS Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/getting-started/verify.en.md Use Homebrew to install GnuPG on macOS. Ensure Homebrew is installed first. ```sh brew install gnupg ``` -------------------------------- ### Install Copilot CLI with Homebrew Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/getting-started/install.en.md Use this command to install the AWS Copilot CLI on macOS using Homebrew. Ensure Homebrew is installed and configured. ```sh brew install aws/tap/copilot-cli ``` -------------------------------- ### Install Copilot CLI with Homebrew Source: https://github.com/aws/copilot-cli/blob/mainline/README.md Use this command to install the AWS Copilot CLI on macOS using Homebrew. ```bash $ brew install aws/tap/copilot-cli ``` -------------------------------- ### Initialize Environment and Deploy All Workloads Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/blogs/release-v131.en.md Use this command to initialize the development environment and deploy all local workloads, including initializing any new workloads. This is useful when cloning a new repository with multiple services. ```bash copilot deploy --init-env --deploy-env -e dev --all --init-wkld ``` -------------------------------- ### Install OpenTelemetry Dependencies for Node.js Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/developing/observability.en.md Install the necessary npm packages for instrumenting an Express.js service with OpenTelemetry and AWS X-Ray. ```bash npm install express \ @opentelemetry/api \ @opentelemetry/sdk-trace-node \ @opentelemetry/auto-instrumentations-node \ @opentelemetry/exporter-trace-otlp-grpc \ @opentelemetry/id-generator-aws-xray \ @opentelemetry/propagator-aws-xray ``` -------------------------------- ### Initialize and Deploy Service Source: https://context7.com/aws/copilot-cli/llms.txt Use 'copilot deploy --init-env --deploy-env' to initialize a new environment and deploy a service in one step. Specify profile and region if needed. ```bash copilot deploy --init-env --deploy-env --env test --name api \ --profile default --region us-west-2 ``` -------------------------------- ### Install Copilot CLI on Windows Manually Source: https://github.com/aws/copilot-cli/blob/mainline/README.md Manually install the AWS Copilot CLI on Windows by downloading the executable from GitHub releases. ```powershell Invoke-WebRequest -OutFile 'C:\Program Files\copilot.exe' https://github.com/aws/copilot-cli/releases/latest/download/copilot-windows.exe ``` -------------------------------- ### Initialize Application and Deploy Service Source: https://context7.com/aws/copilot-cli/llms.txt Use `copilot init` to start a new application, create an ECR repository, and optionally deploy a service with its infrastructure. Supports different service types like Load Balanced Web Service, Backend Service, Request-Driven Web Service, and Scheduled Job. ```bash copilot init --app demo \ --name api \ --type 'Load Balanced Web Service' \ --dockerfile './Dockerfile' \ --deploy ``` ```bash copilot init --app myapp \ --name backend \ --type 'Backend Service' \ --dockerfile './backend/Dockerfile' ``` ```bash copilot init --app myapp \ --name frontend \ --type 'Request-Driven Web Service' \ --dockerfile './Dockerfile' \ --port 8080 ``` ```bash copilot init --app myapp \ --name report-generator \ --type 'Scheduled Job' \ --dockerfile './Dockerfile' \ --schedule "@daily" \ --retries 3 \ --timeout 1h ``` -------------------------------- ### Install Copilot CLI on macOS Manually Source: https://github.com/aws/copilot-cli/blob/mainline/README.md Manually install the AWS Copilot CLI on macOS by downloading the binary from GitHub releases. ```bash curl -Lo copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-darwin && chmod +x copilot && sudo mv copilot /usr/local/bin/copilot && copilot --help ``` -------------------------------- ### Install Bash Completion on macOS Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/completion.en.md For macOS users, install bash-completion using Homebrew. Then, redirect the bash completion output to the appropriate directory. ```console $ brew install bash-completion # if running 3.2 ``` ```console $ brew install bash-completion@2 # if running Bash 4.1+ ``` ```console $ copilot completion bash > /usr/local/etc/bash_completion.d ``` -------------------------------- ### Initialize application with resource tags Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/app-init.en.md Apply custom tags to all resources within the application for categorization. Tags are provided as key-value pairs. ```bash $ copilot app init --resource-tags department=MyDept,team=MyTeam ``` -------------------------------- ### Create pipeline manifest and buildspec Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/blogs/release-v120.en.md Run this command to initialize a pipeline manifest and buildspec file for continuous delivery. ```console $ copilot pipeline init Pipeline name: env-pipeline What type of continuous delivery pipeline is this? Environments 1st stage: test 2nd stage: prod ✔ Wrote the pipeline manifest for copilot-pipeline-test at 'copilot/pipelines/env-pipeline/manifest.yml' ✔ Wrote the buildspec for the pipeline's build stage at 'copilot/pipelines/env-pipeline/buildspec.yml' ``` -------------------------------- ### Secrets YAML Example Source: https://context7.com/aws/copilot-cli/llms.txt Example structure for a secrets.yml file used with 'copilot secret init --cli-input-yaml'. Supports environment-specific values. ```yaml db_host: dev: dev.db.example.com test: test.db.example.com prod: prod.db.example.com db_password: dev: dev-password-123 test: test-password-456 prod: prod-password-789 ``` -------------------------------- ### Initialize Environment with Configurable Defaults Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/developing/custom-environment-resources.en.md Use this command to initialize a new environment while opting to configure default resources, such as VPC CIDR ranges and availability zones. This is useful when you need to deviate from Copilot's standard defaults. ```bash $ copilot env init --container-insights What is your environment's name? env-name Which credentials would you like to use to create name? [profile default] Would you like to use the default configuration for a new environment? - A new VPC with 2 AZs, 2 public subnets and 2 private subnets - A new ECS Cluster - New IAM Roles to manage services and jobs in your environment [Use arrows to move, type to filter] Yes, use default. > Yes, but I'd like configure the default resources (CIDR ranges). No, I'd like to import existing resources (VPC, subnets). What VPC CIDR would you like to use? [? for help] (10.0.0.0/16) Which availability zones would you like to use? [Use arrows to move, space to select, type to filter, ? for more help] [x] us-west-2a [x] us-west-2b > [x] us-west-2c [ ] us-west-2d What CIDR would you like to use for your public subnets? [? for help] (10.0.0.0/24,10.0.1.0/24) 10.0.0.0/24,10.0.1.0/24,10.0.2.0/24 What CIDR would you like to use for your private subnets? [? for help] (10.0.2.0/24,10.0.3.0/24) 10.0.3.0/24,10.0.4.0/24,10.0.5.0/24 ``` -------------------------------- ### Install Copilot CLI on Linux (ARM) Manually Source: https://github.com/aws/copilot-cli/blob/mainline/README.md Manually install the AWS Copilot CLI on Linux ARM by downloading the binary from GitHub releases. ```bash curl -Lo copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-linux-arm64 && chmod +x copilot && sudo mv copilot /usr/local/bin/copilot && copilot --help ``` -------------------------------- ### Copilot CLI Error Message Example Source: https://github.com/aws/copilot-cli/blob/mainline/STYLE_GUIDE.md This example illustrates how Copilot CLI displays an error message when a command fails due to insufficient permissions. ```bash ✘ Failed! could not create directory "copilot": no permissions ``` -------------------------------- ### Initialize workload before deployment Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/deploy.en.md The `--init-wkld` flag can be used with `--all` to initialize any uninitialized workloads before proceeding with the deployment. This ensures all necessary configurations are in place. ```console copilot deploy --all --init-wkld ``` -------------------------------- ### Install Specific Copilot CLI Version on macOS Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/getting-started/install.en.md Download and install a specific version of the AWS Copilot CLI on macOS. Replace 'v0.6.0' with the desired version number. ```sh curl -Lo copilot https://github.com/aws/copilot-cli/releases/download/v0.6.0/copilot-darwin && chmod +x copilot && sudo mv copilot /usr/local/bin/copilot && copilot --help ``` -------------------------------- ### Run Multiple Tasks with Custom Resources and Image Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/task-run.en.md Launch 4 tasks, each with 2GB of memory. This example also specifies an existing image 'rds-migrate' and a custom task role 'migrate-role'. The --follow flag enables log streaming. ```console $ copilot task run --count 4 --memory 2048 --image=rds-migrate --task-role migrate-role --follow ``` -------------------------------- ### Install Copilot CLI on Linux x86 (64-bit) Manually Source: https://github.com/aws/copilot-cli/blob/mainline/README.md Manually install the AWS Copilot CLI on Linux x86 (64-bit) by downloading the binary from GitHub releases. ```bash curl -Lo copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-linux && chmod +x copilot && sudo mv copilot /usr/local/bin/copilot && copilot --help ``` -------------------------------- ### Help for Package Command Source: https://github.com/aws/copilot-cli/wiki/app-package-command View available flags and their descriptions for the `ecs-preview app package` command. ```bash $ ecs-preview app package --help ``` -------------------------------- ### Deploy a Service Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/deploy.en.md Use this command to deploy a specific service to an environment. Ensure the service and environment are already initialized. ```console $ copilot deploy --name frontend --env test ``` -------------------------------- ### FireLens Logging Configuration Example Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/developing/sidecars.en.md This example demonstrates how to configure the FireLens log driver to send logs to Amazon CloudWatch. It specifies the destination, region, and a log stream prefix for organizing logs. ```yaml logging: destination: Name: cloudwatch region: us-west-2 log_group_name: /copilot/sidecar-test-hello log_stream_prefix: copilot/ ``` -------------------------------- ### Start interactive bash session in default cluster Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/task-exec.en.md Starts an interactive bash session in a task within the default cluster, identified by its task ID. This is useful for quick debugging in default environments. ```console $ copilot task exec --default --task-id 38c3818 ``` -------------------------------- ### Configure HTTP Healthcheck Path Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/manifest/rd-web-service.en.md Example of specifying a custom path for HTTP health checks. ```yaml http: healthcheck: '/_healthcheck' ``` -------------------------------- ### Sample Workspace Layout for Environment Addons Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/developing/addons/environment.en.md Illustrates the directory structure for storing environment-specific CloudFormation addon templates within a Copilot project. ```term .\\ └── copilot\\ └── environments\\ ├── addons # Store environment addons.\\ │ └── mys3.yaml\\ ├── dev\\ └── prod ``` -------------------------------- ### Show application info Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/app-show.en.md Displays configuration, environments, and services for a specified application. Use the `-n` flag to name the application. ```console $ copilot app show [flags] ``` ```console $ copilot app show -n my-app ``` -------------------------------- ### Package Application with Options Source: https://github.com/aws/copilot-cli/wiki/app-package-command This command packages the application for deployment, allowing you to specify the environment, application name, output directory, and image tag. ```bash $ ecs-preview app package --name my-app --env prod --tag v1.0 --output-dir ./cfn ``` -------------------------------- ### Disable Scheduled Job Trigger Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/manifest/scheduled-job.en.md Example of how to disable a scheduled job from triggering by setting the schedule field to 'none'. ```yaml on: schedule: "none" ``` -------------------------------- ### Configuring Copilot-Generated VPC Subnets Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/manifest/environment.en.md Example of configuring public subnets with CIDR and availability zone for a Copilot-generated VPC. ```yaml network: vpc: cidr: '10.0.0.0/16' subnets: public: - cidr: '10.0.0.0/24' az: 'us-east-2a' - cidr: '10.0.1.0/24' az: 'us-east-2b' ``` -------------------------------- ### Initialize and Deploy Environment and Service Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/deploy.en.md This command initializes a new environment, deploys it, and then deploys a specified service. It configures the deployment region and uses a specific AWS profile. ```console $ copilot deploy --init-env --deploy-env --env test --name api --profile default --region us-west-2 ``` -------------------------------- ### Specify Task Definition Overrides Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/developing/overrides/taskdef-overrides.en.md Example of taskdef_overrides to set CPU and Memory for a container. These rules are applied sequentially. ```yaml taskdef_overrides: - path: ContainerDefinitions[0].Cpu value: 512 - path: ContainerDefinitions[0].Memory value: 1024 ``` -------------------------------- ### Show Copilot Application Summary Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/concepts/applications.en.md Run this command to display a summary of your application, including services, environments, and pipelines. ```console $ copilot app show About Name vote Version v1.1.0 URI vote-app.aws Environments Name AccountID Region ---- --------- ------ test 000000000000 us-east-1 Workloads Name Type Environments ---- ---- ------------ collector Load Balanced Web Service prod aggregator Backend Service test, prod Pipelines Name ---- ``` -------------------------------- ### Initialize Storage Resource Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/storage-init.en.md Use this command to create a new storage resource. Specify the lifecycle, name, storage type, and the workload that will access it. ```console $ copilot storage init ``` -------------------------------- ### Define Deployment Dependencies Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/manifest/pipeline.en.md Specify other pre-deployment actions that must complete before the current action can start. Defaults to no dependencies. ```yaml stages: - name: test pre_deployments: my_action: depends_on: - previous_action ``` -------------------------------- ### Initialize environment before deployment Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/deploy.en.md Use the `--init-env` flag to confirm the initialization of the target environment if it does not already exist. This is part of the deployment process. ```console copilot deploy --init-env ``` -------------------------------- ### Initialize a Request-Driven Web Service Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/blogs/apprunner-waf.en.md Use this command to create and configure a new App Runner service of type 'Request-Driven Web Service'. Alternatively, run `copilot svc init` and follow the prompts. ```console copilot init \ --svc-type "Request-Driven Web Service" \ --name "waf-example" \ --dockerfile path/to/Dockerfile ``` -------------------------------- ### Configure Detailed HTTP Healthcheck Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/manifest/rd-web-service.en.md Example of configuring detailed HTTP healthcheck parameters including thresholds, interval, and timeout. ```yaml http: healthcheck: path: '/' healthy_threshold: 3 unhealthy_threshold: 2 interval: 15s timeout: 10s ``` -------------------------------- ### Using Secrets in Manifest Source: https://context7.com/aws/copilot-cli/llms.txt Example of how to reference secrets defined in Parameter Store within a Copilot service manifest (manifest.yml). ```yaml # copilot/api/manifest.yml secrets: DB_PASSWORD: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/db_password ``` -------------------------------- ### Initialize Environments Pipeline Source: https://context7.com/aws/copilot-cli/llms.txt Use `copilot pipeline init` to set up a new pipeline for managing environments. Specify the pipeline name, type, and the environments it will manage. ```bash copilot pipeline init \ --name env-pipeline \ --pipeline-type Environments \ --environments "dev,staging,prod" ``` -------------------------------- ### Confirmation Skip Flag Source: https://github.com/aws/copilot-cli/blob/mainline/STYLE_GUIDE.md Provides an example of a flag used to bypass confirmation prompts for destructive actions on production resources. ```bash -y, --yes ``` -------------------------------- ### Deploy Sample Application with Copilot Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/blogs/apprunner-vpc.en.md Deploy the 'demo-service' application to the 'test' environment using the AWS Copilot CLI. This command builds the container image locally, pushes it to ECR, and provisions the necessary AWS resources. Ensure the Docker daemon is running. ```bash copilot svc deploy --name demo-service --env test ``` -------------------------------- ### Configure HTTP Private Endpoint Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/manifest/rd-web-service.en.md Example of configuring a private HTTP endpoint for a service using an existing VPC Endpoint ID. ```yaml http: private: endpoint: vpce-12345 ``` -------------------------------- ### Advanced Copilot Application Initialization Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/concepts/applications.en.md Use this command for more granular control over application setup, including specifying a custom domain, adding resource tags, and setting a permissions boundary for IAM roles. ```bash copilot app init \ --domain my-awesome-app.aws \ --resource-tags department=MyDept,team=MyTeam \ --permissions-boundary my-pb-policy ``` -------------------------------- ### Existing Manifest Will Keep Working (Flawed Hierarchy) Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/blogs/release-v123.en.md An example of an environment manifest using the flawed hierarchy that will continue to function after the update. ```yaml # Flawed hierarchy but will keep working. http: public: security_groups: ingress: restrict_to: cdn: true ``` -------------------------------- ### Initialize a Request-Driven Web Service Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/blogs/apprunner-vpc.en.md Deploy a service using the Request-Driven Web Service pattern, suitable for HTTP services with variable traffic. This command specifies the application, service type, name, port, and Dockerfile location. ```bash copilot svc init \ --app apprunner-vpc \ --svc-type "Request-Driven Web Service" \ --name demo-service\ --port 5000 \ --dockerfile "demo-service/Dockerfile" ``` -------------------------------- ### Initialize and Deploy a Workload Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/deploy.en.md Initialize a new workload and deploy it to an existing environment. The `--deploy-env=false` flag prevents redeploying the environment. ```console $ copilot deploy --init-wkld --deploy-env=false --env prod --name backend ``` -------------------------------- ### Install Bash Completion on Linux Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/completion.en.md On Linux, you can source the bash completion script directly or save it to the bash completion directory for system-wide availability. ```console $ source <(copilot completion bash) ``` ```console $ copilot completion bash > copilot.sh ``` ```console $ sudo mv copilot.sh /etc/bash_completion.d/copilot ``` -------------------------------- ### Initialize App and Deploy Service with Copilot CLI Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/blogs/release-v130.en.md Use `copilot app init` to initialize your application and then `copilot deploy` to deploy a service and environment. This command can prompt for necessary initializations if they haven't been done. ```console $ git clone myrepo $ cd myrepo $ copilot app init myapp $ copilot deploy -n frontend -e prod ``` -------------------------------- ### Show Environment Manifest Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/env-show.en.md To view the manifest file used for deploying a specific environment, use the --manifest flag along with the environment name. ```console $ copilot env show -n prod --manifest ``` -------------------------------- ### Replace an Existing Property's Value Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/developing/overrides/yamlpatch.en.md Use the `replace` operation to update the value of an existing property. This example changes the `RetentionInDays` for a LogGroup. ```yaml - op: replace path: /Resources/LogGroup/Properties/RetentionInDays value: 60 ``` -------------------------------- ### Help for version command Source: https://github.com/aws/copilot-cli/blob/mainline/site/content/docs/commands/version.en.md View available flags for the version command. This is useful for understanding command options. ```console -h, --help help for version ``` -------------------------------- ### List Services in Table Format Source: https://github.com/aws/copilot-cli/blob/mainline/STYLE_GUIDE.md List services using a table format, with the resource name in the first column and contextual metadata in subsequent columns. Keep the output concise for list commands. ```bash $ copilot svc ls Name Type -------- --------------------- kudos-api Load Balanced Web App ```