aws / copilot-cli

The AWS Copilot CLI is a tool for developers to build, release and operate production ready containerized applications on AWS App Runner or Amazon ECS on AWS Fargate.
https://aws.github.io/copilot-cli/
Apache License 2.0
3.49k stars 404 forks source link

Storage Init doesn't show jobs in list of services #1595

Open bvtujo opened 3 years ago

bvtujo commented 3 years ago

When you create a job in a copilot workspace, then run copilot storage init, the job is not found, as the storage command only looks for local services.

hundredwatt commented 3 years ago

As a workaround, I created an add-on for an S3 bucket:

# You can use any of these parameters to create conditions or mappings in your template.
Parameters:
  App:
    Type: String
    Description: Your application's name.
  Env:
    Type: String
    Description: The environment name your service, job, or workflow is being deployed to.
  Name:
    Type: String
    Description: The name of the service, job, or workflow being deployed.

Resources:
  S3Bucket:
    Type: AWS::S3::Bucket

  S3BucketAccessPolicy:
    Type: AWS::IAM::ManagedPolicy
    Properties:
      PolicyDocument:
        Version: 2012-10-17
        Statement:
          - Sid: S3WriteOnly
            Effect: Allow
            Action:
              - s3:PutObject
              - s3:PutObjectACL
            Resource: !Sub ${ S3Bucket.Arn}/*

Outputs:
  S3Bucket:
    Description: "The name of the S3 Bucket"
    Value: !Ref S3Bucket

  S3BucketAccessPolicyArn:
    Description: "The ARN of the ManagedPolicy to attach to the task role."
    Value: !Ref S3BucketAccessPolicy