Skip to content

Issue#240 create lambda cloud formation template #283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: development
Choose a base branch
from

Conversation

ahmadafrasiyab
Copy link
Contributor

This pull request is for automating lambda deployment using AWS cloud formation and boto3.

Note
The PR is not ready for merge as there are authorization issues on AWS while deployment.

@ahmadafrasiyab ahmadafrasiyab added task New task, feature or request team2 Issues for Practicum Team 2 labels Mar 18, 2021
@ahmadafrasiyab ahmadafrasiyab added this to the Sprint 05 milestone Mar 18, 2021
@ahmadafrasiyab ahmadafrasiyab requested a review from toddysm March 18, 2021 07:13
@ahmadafrasiyab ahmadafrasiyab self-assigned this Mar 18, 2021
@ahmadafrasiyab
Copy link
Contributor Author

Pre-requisites

  1. You will need to install boto3 and python(if you don't have it already)
  2. Please use $ python -m pip install boto3 to install boto3
  3. AWS access key and secret are required. Currently there are authorization issues during deployment using both personal and gha access keys and secrets
  4. The template.json inside the lambda cloudFormation folder is for reference. The actual template(which is the same one as template.json) is being served from an S3 bucket as boto3 command required a valid URL for the template. I was not able to figure out how to give it a template file locally.
  5. The function code can be added inline as in this PR or it can be zipped and pulled from a separate S3 bucket.

Instructions

  1. Please pull the code in your local machine. Change your directory to Automation/lambda cloudFormation.
  2. Use the following command:
    python lambdaCloudFormationDeploy.py AWS_ACCESS_KEY AWS_SECRET THE_NAME_OF_YOUR_STACK
  3. If the deployment goes well, you should see the following message:
Response Data:  {'StackId': 'arn:aws:cloudformation:us-west-2:061431082068:stack/afrasiyabtest1/acd11d50-87b8-11eb-9078-0296b3ac8a31', 'ResponseMetadata': {'RequestId': '3490b863-ad1ponseMetadata': {'RequestId': '3490b863-ad11-4610-9e14-869f72de07a5', 
'HTTPStatusCode': 200, 'HTTPHeaders': {'x-amzn-requestid': '3490b863-': 'text/xml', 'content-length': '384', 
'daad11-4610-9e14-869f72de07a5', 'content-type': 'text/xml', 'content-length': '384',
 'date': 'Thu, 18 Mar 2021 07:08:00 GMT'}, 'RetryAttempts': 0}}

Operation Successful
  1. You can verify the stack by going over to AWS console, searching "Cloud Formation" and seeing the name of your lambda function created successfully.

Shoutout to @jleeboyd for helping with the boto3 script.

@ahmadafrasiyab
Copy link
Contributor Author

Date Activity Time Spent
03/05/2021 Setting up issue 15 mins
03/08/2021 Researching templates 2 hours
03/12/2021 Setting up boto3 30 mins
03/14/2021 Testing deployment 1 hour
03/17/2021 Creating PR 30 mins

@ahmadafrasiyab
Copy link
Contributor Author

@toddysm I tried using both pairs of AWS access keys and secrets. My personal ones and the GitHub actions ones however for both of them I get authorization issues. For my own I see this:

image

For GitHub ones I see this:

image

Awaiting your feedback on this.

@ahmadafrasiyab ahmadafrasiyab requested a review from jleeboyd March 18, 2021 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task New task, feature or request team2 Issues for Practicum Team 2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] Cloudformation for deploying Lambda function + script to run it with Boto3
1 participant