PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, November 5, 2022

[FIXED] How to get s3 env files in aws sam with github action

 November 05, 2022     amazon-web-services, environment-variables, fastapi, github-actions, sam     No comments   

Issue

These days I research SAM(Serverless Application Model) to deploy my fastapi sample. However, I can't get the s3 env file. The sam cli command is below.

$ sam build --use-container
$ sam deploy

The point of error in the code is below.

content_object = boto3.resource('s3').Object('config', 'test.json')

In the local env, I can get the env file in the s3 bucket, but when I deploy with sam, the error has occurred like this.

[ERROR] ClientError: An error occurred (AccessDenied) when calling the GetObject operation: Access Denied

How to solve this issue? Have any good sources for getting env files in SAM? I just want to make deploy in github action.


Solution

I have an issue that loads an env file with SAM (AWS Serverless Application Model) application(FastAPI). However, I can't load the env file in the python script since SAM env is different from Zappa (Zappa can env file with remote_env in the config file). So, I use the copy method in the GitHub action (workflow).



Answered By - Hans
Answer Checked By - Marie Seifert (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing