aws-samples / public-file-browser-for-amazon-s3

Sample code to deploy a website and a "public files" S3 bucket which can be loaded with any files an administrator wishes to publish publicly online.
MIT No Attribution
104 stars 17 forks source link

Added guidance around AWS SAM deployment #4

Closed troydieter closed 6 months ago

troydieter commented 7 months ago

Hello-

This may be a nit-pick item, but I was unable to deploy with AWS SAM without the additional flags of: --capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND. This was due to it needing to create AWS IAM related AWS resources. I think that it'd be worthwhile to note in the documentation.

Thanks!

ckabalan commented 7 months ago

Thanks for bringing this up. Do you have the exact error you're getting? CAPABILITY_NAMED_IAM is a superset of CAPABILITY_IAM so both should not be necessary. However CAPABILITY_AUTO_EXPAND might be necessary, though I've never had to use this myself. Also provide the output for sam --info if you would, I'm wondering if behavior changed at some point.

I just tested SAM CLI v1.112 with the following switches and it depoyed successfully:

sam deploy --guided --capabilities CAPABILITY_NAMED_IAM

troydieter commented 6 months ago

Thanks @ckabalan - sam deploy --guided --capabilities CAPABILITY_NAMED_IAM worked. Can that be added to the docs?

This didn't work (as originally stated for the issue):

sam deploy --guided --capabilities CAPABILITY_IAM

Output:


        Deploying with following values
        ===============================
        Stack name                   : s3-browser
        Region                       : us-east-1
        Confirm changeset            : True
        Disable rollback             : False
        Deployment s3 bucket         : aws-sam-cli-managed-default-samclisourcebucket-1tj0aq6n731
        Capabilities                 : ["CAPABILITY_IAM"]
        Parameter overrides          : {"SiteName": "Repository", "FilesOpenTabMode": "In New Tab", "VisibleStorageClasses": "REDUCED_REDUNDANCY", "CrossOriginRestriction": "*"}
        Signing Profiles             : {}

Initiating deployment
=====================

File with same data already exists at s3-browser/cf5ce0ac6f476e64c778655446cf35b.template, skipping upload

Waiting for changeset to be created..

Error: Failed to create changeset for the stack: s3-browser, ex: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state: For expression "Status" we matched expected path: "FAILED" Status: FAILED. Reason: Requires capabilities : [CAPABILITY_NAMED_IAM]