Open changtimwu opened 6 years ago
*(simple workflow framework): https://aws.amazon.com/tw/swf/
long term polling
as blocked dequeue
the the default timeout is 20 seconds. It's designed to avoid busy waiting problem of short term polling
. ReceiveMessageWaitTimeSeconds
to adjust default timeout (0~20 seconds)SNS
.ChangeMessageVisibility
visibilitTimeout
means other consumers won't be notified for that specific time. That means the consumer excusively own this messages for a period of time and this can avoid sync problem that multiple consumers concurrently process the same message.ChangeMessageVisibility
to extend the timeout.
_When you receive a message from a queue and begin to process it, the visibility timeout for the queue may be insufficient (for example, you might need to process and delete a message). You can shorten or extend a message's visibility by specifying a new timeout value using the ChangeMessageVisibility action.)sqs get-queue-url --queue-name fuckq
{
"QueueUrl": "https://queue.amazonaws.com/406995953077/fuckq"
}
try read FAQ https://aws.amazon.com/sqs/faqs/ You can configure the Amazon SQS message retention period to a value from 1 minute to 14 days. The default is 4 days. Once the message retention limit is reached, your messages are automatically deleted.
a message is made of the three attributes(name
/type
/value
)
https://docs.aws.amazon.com/sns/latest/dg/SNSMessageAttributes.html
Name, type, and value must not be empty or null. In addition, the message body should not be empty or nul
{
"Type" : "Notification",
"MessageId" : "63a3f6b6-d533-4a47-aef9-fcf5cf758c76",
"TopicArn" : "arn:aws:sns:us-west-2:123456789012:MyTopic",
"Subject" : "Testing publish to subscribed queues",
"Message" : "Hello world!",
"Timestamp" : "2012-03-29T05:12:16.901Z",
"SignatureVersion" : "1",
"Signature" : "EXAMPLEnTrFPa37tnVO0FF9Iau3MGzjlJLRfySEoWz4uZHSj6ycK4ph71Zmdv0NtJ4dC/El9FOGp3VuvchpaTraNHWhhq/OsN1HVz20zxmF9b88R8GtqjfKB5woZZmz87HiM6CYDTo3l7LMwFT4VU7ELtyaBBafhPTg9O5CnKkg=",
"SigningCertURL" : "https://sns.us-west-2.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem",
"UnsubscribeURL" : "https://sns.us-west-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-west-2:123456789012:MyTopic:c7fe3a54-ab0e-4ec2-88e0-db410a0f2bee"
}
example notfication to http end point
POST / HTTP/1.1
x-amz-sns-message-type: SubscriptionConfirmation
x-amz-sns-message-id: 165545c9-2a5c-472c-8df2-7ff2be2b3b1b
x-amz-sns-topic-arn: arn:aws:sns:us-west-2:123456789012:MyTopic
Content-Length: 1336
Content-Type: text/plain; charset=UTF-8
Host: example.com
Connection: Keep-Alive
User-Agent: Amazon Simple Notification Service Agent
{
"Type" : "SubscriptionConfirmation",
"MessageId" : "165545c9-2a5c-472c-8df2-7ff2be2b3b1b",
"Token" : "2336412f37fb687f5d51e6e241d09c805a5a57b30d712f794cc5f6a988666d92768dd60a747ba6f3beb71854e285d6ad02428b09ceece29417f1f02d609c582afbacc99c583a916b9981dd2728f4ae6fdb82efd087cc3b7849e05798d2d2785c03b0879594eeac82c01f235d0e717736",
"TopicArn" : "arn:aws:sns:us-west-2:123456789012:MyTopic",
"Message" : "You have chosen to subscribe to the topic arn:aws:sns:us-west-2:123456789012:MyTopic.\nTo confirm the subscription, visit the SubscribeURL included in this message.",
"SubscribeURL" : "https://sns.us-west-2.amazonaws.com/?Action=ConfirmSubscription&TopicArn=arn:aws:sns:us-west-2:123456789012:MyTopic&Token=2336412f37fb687f5d51e6e241d09c805a5a57b30d712f794cc5f6a988666d92768dd60a747ba6f3beb71854e285d6ad02428b09ceece29417f1f02d609c582afbacc99c583a916b9981dd2728f4ae6fdb82efd087cc3b7849e05798d2d2785c03b0879594eeac82c01f235d0e717736",
"Timestamp" : "2012-04-26T20:45:04.751Z",
"SignatureVersion" : "1",
"Signature" : "EXAMPLEpH+DcEwjAPg8O9mY8dReBSwksfg2S7WKQcikcNKWLQjwu6A4VbeS0QHVCkhRS7fUQvi2egU3N858fiTDN6bkkOxYDVrY0Ad8L10Hs3zH81mtnPk5uvvolIC1CXGu43obcgFxeL3khZl8IKvO61GWB6jI9b5+gLPoBc1Q=",
"SigningCertURL" : "https://sns.us-west-2.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem"
}
Limits and Restrictions Q: Are there limits to the number of topics or number of subscribers per topic?
JSON
or YAML
stack creation time
Fn:GetAtt
to get output data, which is what only can be told after deploy ex. public IPAWSTemplateFormatVersion: "version date"
Description:
String
Metadata:
template metadata
Parameters:
set of parameters
Mappings:
set of mappings
Conditions:
set of conditions
Transform:
set of transforms
Resources:
set of resources
Outputs:
set of outputs
only Resources
is required
Fn:GetAttr
, Fn::FindInMap
, Ref
, Fn::Select
(this is 0 based)list-stacks
or describe-stacks
describe-stack-resources --stack-name <stack name>
10 read 1KB --> 10*4KB/4KB /2 =5 units of read throughput
10 read 6KB --> 10*8KB/4KB / 2 = 10 units of read througtput
5 read 10KB -> 5*12KB/4KB / 2 = 7.5 ~ 8 units of read throughput
5 read 10KB and strong consistency -> 5*12KB/4KB = 15 units of read throughtput
5 write 10KB -> 5*10KB = 50 units of write throughput
12 write 100KB -> 12*100KB = 1200 units of write throughput
10 write 15.5KB -> 10 * 16KB = 160 unit of write
throughput exceed errors -> HTTP 400 ProvisionedThroughputExceedException
AssumedRoleWithWebIdentity
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html
BatchGetItem
operation can retrieve a maximum of 100 items. The total size of all the items retrieved cannot exceed 16 MB.BatchWriteItem
operation can contain up to 25 PutItem or DeleteItem requests. The total size of all the items written cannot exceed 16 MB.ProjectionExpression
: All or Selected AttributesScanIndexForward
: Ascending or DescendingCreateTable
, DescribeTable
, ListTables
, UpdateTable
, DeleteTable
PutItem
, GetItem
, BatchPutItem
, BatchGetItem
, Query
(composite primary key)default VPC
main route table
main route table
, 每次 create new subnet 預設就是走這個 main route tableedit
不修改 save
, 去 route table看再也不會警告 The following subnets have not been explicitly associated with any route tables and are therefore associated with the main route table10.0.0.0/24
, 2:10.0.1.0/24
, 3: 10.0.2.0/24
1
is allowed to visit the Internet. It's known as a public subnet
.2
is only allowed visit subnets within the same VPC. It's known as a private subnet
.3
can only visit corporate network. It's known as a VPN-only subnet
.between 3 and 63 characters long, and can contain only lower-case characters, numbers, periods, and dashes. Each label in the bucket name must start with a lowercase letter or number.The bucket name cannot contain underscores, end with a dash, have consecutive periods, or use dashes adjacent to periods.
x-amz-server-side-encryption
optionsaws s3 cp
就會變快
FIGHTDRMCPX
: FPGA, IOPS(High Speed Storage), Graphics, HighSpeedDisk, Trivial(dirty cheap), Dense Storage, Ram, M(many, general purpose), Compute, P( machine learning, high end graphic), X(exessive large memory)
EBS type:
EFS: elastic file system, can be shared between instance
那個 region 的 VPC都還沒設定過, 開 instance 時 configure
的 network
& subnet
還是會出現 VPC default
選 subnet
其實就是選 zone
security group is virtual firewall.
any rule you apply to security group take effect immediately.
aws
inside the instance)create 的時候UI強迫一定要選 network 與 subnet, 這時候network 選 VPC, subnet 選 VPC 那邊 create 的subnet, 後面又要求 configure security group, 這個 SG的 firewall rule 似乎可以跟 subnet 完全不相容. ?
tested
https://docs.aws.amazon.com/cli/latest/reference/ec2/attach-volume.html
list ami images -> describe-images
role 有可以理解成兩個簡單的基本
Query 與 Scan 可以對
一個 table 的 primary key 可以是
userid
- partition keygame title
- sort keyTopScore
, TopScoreDateTime
, Wins
, Losses
一定要用 user id
+ game title
下去 query, 想只用 game title
查, 或是用其他 attribute, 就只能用很慢的 scan
secondary index could be made of partiton key and sort key
GameTitle
as partitionTopScore
as sort
GameScoreIndex
就可以拿來查某遊戲的最高分TopScoreDateTime
做 local secondary index
After test I took the new version(released in June 2018). I quite like changes this time. More new stuff(XRay, build/deploy pipeline). More related to practical development. More rely on experience instead of memorization.
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
https://rickhw.github.io/2018/06/05/AWS/AWS-Certified-DVA-C01-Update/
launch stack
to launch a cloudformation template
https://aws.amazon.com/blogs/devops/construct-your-own-launch-stack-url/codestar/codepipeline define the following
force myself refresh everything by scheduling an urgent exam(June/13).
all white papers
https://aws.amazon.com/whitepapers/
all reinvents
https://reinventvideos.com/
all FAQs
https://aws.amazon.com/faqs/
just follow official preparation steps
https://aws.amazon.com/certification/certification-prep/