Ask
Allow writing templates in the addons/ directory that can refer to local artifacts (local paths).
Copilot should upload local artifacts, such as source code for an AWS Lambda function or a Swagger file for an AWS API Gateway REST API, to an S3 bucket. Following that, it should write an edited version of the template replacing references to local artifacts with the S3 location of the artifacts. Finally, this transformed template should be uploaded to the S3 bucket and used for the AddonsStack.
This functionality should be in parity with the aws cloudformation package command.
Gitter thread: https://gitter.im/aws/copilot-cli?at=627a8caaeaf3267f8553fef6
Example
Let's imagine I have the following workspace structure:
.
├── copilot/
│ └── api/
│ ├── manifest.yml
│ └── addons/
│ └── ddb.yml
└── src/
├── ...
└── lambda/
└── stream-replicator.py
In the ddb.yml template, I'd like to refer to the src/lambda/stream-replicator.py function directly in the template. Otherwise, I'd need to run aws cloudformation package --template-file copilot/api/addons/ddb.yml before copilot deploy. Instead, I want copilot to take over this burden:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
ProcessDynamoDBStream:
Type: AWS::Serverless::Function
Properties:
CodeUri: /src/lambda/stream-replicator.py # NEW
...
Copilot should zip the file and upload it to the environment regional S3 bucket:
|
ArtifactBucketARN string // ARN of the regional application bucket. |
This is already where Copilot uploads pipeline, and manual deployment artifacts.
Then Copilot will transform the template such that the Serverless Function's CodeUri has the s3 URL as value.
Specification
We should have parity with the AWS CLI:
BodyS3Location property for the AWS::ApiGateway::RestApi resource
Code property for the AWS::Lambda::Function resource
CodeUri property for the AWS::Serverless::Function resource
DefinitionS3Location property for the AWS::AppSync::GraphQLSchema resource
RequestMappingTemplateS3Location property for the AWS::AppSync::Resolver resource
ResponseMappingTemplateS3Location property for the AWS::AppSync::Resolver resource
DefinitionUri property for the AWS::Serverless::Api resource
Location parameter for the AWS::Include transform
SourceBundle property for the AWS::ElasticBeanstalk::ApplicationVersion resource
TemplateURL property for the AWS::CloudFormation::Stack resource
Command.ScriptLocation property for the AWS::Glue::Job resource
DefinitionS3Location property for the AWS::StepFunctions::StateMachine resource
https://docs.aws.amazon.com/cli/latest/reference/cloudformation/package.html
Ask
Allow writing templates in the
addons/directory that can refer to local artifacts (local paths).Copilot should upload local artifacts, such as source code for an AWS Lambda function or a Swagger file for an AWS API Gateway REST API, to an S3 bucket. Following that, it should write an edited version of the template replacing references to local artifacts with the S3 location of the artifacts. Finally, this transformed template should be uploaded to the S3 bucket and used for the
AddonsStack.This functionality should be in parity with the
aws cloudformation packagecommand.Gitter thread: https://gitter.im/aws/copilot-cli?at=627a8caaeaf3267f8553fef6
Example
Let's imagine I have the following workspace structure:
In the
ddb.ymltemplate, I'd like to refer to thesrc/lambda/stream-replicator.pyfunction directly in the template. Otherwise, I'd need to runaws cloudformation package --template-file copilot/api/addons/ddb.ymlbeforecopilot deploy. Instead, I want copilot to take over this burden:Copilot should zip the file and upload it to the environment regional S3 bucket:
copilot-cli/internal/pkg/deploy/env.go
Line 29 in 2d16694
This is already where Copilot uploads pipeline, and manual deployment artifacts.
Then Copilot will transform the template such that the Serverless Function's
CodeUrihas the s3 URL as value.Specification
We should have parity with the AWS CLI:
https://docs.aws.amazon.com/cli/latest/reference/cloudformation/package.html