일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- AZURE
- openhack
- Network Design
- GCP
- docker
- install
- 데이터 엔지니어링
- pester
- CI
- DevOps
- azure governance
- ADF
- PowerShell
- docker katacoda
- arm
- 유럽
- streaming
- 관심사
- data factory
- Python
- ansible
- automation
- CCBA
- aks
- 아시아
- Kubernetes
- Jenkins
- packer
- job
- BABOK
Archives
- Today
- Total
소소한 기록
Linux academy: Working with Aliases and Versions for Your AWS Lambda Functions 본문
DevOps/Serverless2
Linux academy: Working with Aliases and Versions for Your AWS Lambda Functions
John C Kim 2019. 9. 27. 14:17Working with Aliases and Versions for Your AWS Lambda Functions
Introduction
In this hands-on lab, we we will create a Lambda function, and then build a new version using updated code. Once we have two separate versions, we will then see how we can utilize aliases for rapid code progression.
Solution
Log in to the live AWS environment using the credentials provided. Make sure you're in the N. Virginia (us-east-1) region throughout the lab.
All of the code used in the lesson is available for download here.
Create Your Lambda Function
- Navigate to Lambda.
- Click Create a function.
- Make sure the Author from scratch option at the top is selected, and then use the following settings:
- Name: CreateThumbnail
- Runtime: Node.js 8.10
- Role: Choose an existing role
- Existing role: lambda_exec_role_LA
- Click Create function.
- On the CreateThumbnail page, scroll to the Function code section.
- Set Code entry type to Upload a .ZIP file and upload the file from GitHub.
- Click Save.
- In the Environment variables section, set the following values:
- Key: DST_BUCKET
- Value:
- Navigate to S3 in a new browser tab.
- Click the listed bucketb.
- Copy the cfst name at the top.
- Back in the Environment variables section, paste the value in for Value here.
- In the Basic settings section, set the following values:
- Memory (MB): 1024 MB
- Timeout: 10 seconds
- Click Save.
Configure Your Event Source Mapping (S3 Trigger)
- In the Designer section, select S3.
- In the Configure triggers section, set the following values:
- Bucket: bucketa
- Event type: Object Created (All)
- Filter pattern: .jpg
- Enable trigger: Check
- Click Add, and then Save.
Test Your Function
- In a new browser tab, navigate to S3.
- Click to open bucketa.
- Upload a .jpg image to bucketa.
- In the Lambda console, select the Monitoring tab and wait a few seconds to verify your function was invoked.
- In S3, check for the resized image in bucketb.
Create a New Version and Alias
- At the top of the Lambda console, click Actions and select Publish new version.
- Give it a description (e.g., "Ver A"), and click Publish.
- In the Actions dropdown, select Create alias, and set the following values:
- Name: PROD
- Description: Prod
- Version: 1
- Click Create.
Recreate Your Event Source Mapping
- Verify you are working on the new PROD alias you created. The ARN should be visible on the top right with :PROD on the end.
- In the Designer section, select S3.
- In the Configure triggers section, set the following values:
- Bucket: bucketc
- Event type: Object Created (All)
- Filter pattern: .jpg
- Enable trigger: Check
- Click Add, and then Save.
- In the S3 tab, open bucketc and upload the same .jpg as before.
- In the Lambda console, select the Monitoring tab and wait a few seconds to verify your function was invoked.
Publish a Second Version and Remap Your Alias
- In the Lambda console, click the Alias:PROD dropdown and select $LATEST.
- In the Function code section, under //constants, set the MAX_WIDTH and MAX_HEIGHT to 100.
- Click Save.
- Click Actions and select Publish new version.
- Give it a description (e.g., "Ver B"), and click Publish.
- In the Version: 2 dropdown, select the Aliases tab and click the PROD alias.
- Scroll to the Aliases section, and set the Version to 2.
- Click Save.
- In the S3 tab, open bucketc and upload the same .jpg as before.
- In the Lambda console, select the Monitoring tab and wait a few seconds to verify your function was invoked.
- In S3, check for the resized image in bucketb.