By using AWS re:Post, you agree to the Terms of Use

Learn AWS faster by following popular topics

see all
1/18

Recent questions

see all
1/18

Cloudfront Edge functions

I'm trying to play Instagram Video assets. The challenge is the videos are expirable. They expire every N mins. I'm brainstorming a solution where I set up my CDN (Cloudfront) which forwards the incoming requests to the original server (Instagram in this case), caches the video at CDN, and then keeps serving it without the need to request Instagram again. I don't want to download the videos and keep them in my bucket. I'd a look at CloudFront functions and was able to redirect the incoming requests to another URL, basis on some conditions. Following is the code. function handler(event) { var request = event.request; var headers = request.headers; if request.uri == '/assets/1.jpg'{ var newurl = 'https://instagram.com/media/1.jpg' var response = { statusCode: 302, statusDescription: 'Found', headers: { "location": { "value": newurl } } } return response; } return request } However, this redirects it to the newURL. What I'm looking for is not a redirect, but the following 1) when the request is made to my server CDN, ie `mydomain.com/assets/1.jpg`, the file `1.jpg` should be served from the **Instagram** server, whose value is the `newURL` in the above code snippet. This should be done without changing my domain URL (in the address bar) to Instagram. 2) The following requests to `mydomain.com/assets/1.jpg` should be directly served from the cache, and should not be routed again to Instagram. Any help in this regard is highly appreciated.
0
answers
0
votes
3
views
asked 35 minutes ago

How do I create an RDS option group then reference that group for the RDS instance in Cloud Formation?

I am creating a cloud formation script that creates a ec2 instance as a bastion host, a RDS option group to allow for S3 backup and restoring, and a RDS db instance. In that script, I want to make an option group then immediately use it on the RDS instance. However, I get this error ` "Specified OptionGroupName: rdsoptiongrouprestore not found.` The formation template looks likes this: ``` "RdsDbCcw": { "Type": "AWS::RDS::DBInstance", "Properties": { "DBInstanceClass": { "Ref": "DBInstanceClass" }, "Engine": { "Ref": "DBEngine" }, "MasterUserPassword": { "Ref": "DBAdminPassword" }, "MasterUsername": "admin", "MultiAZ": false, "PubliclyAccessible": false, "StorageType": "gp2", "DBSubnetGroupName": { "Ref": "SubnetGroupID" }, "AllocatedStorage": 20, "OptionGroupName": "RDSoptiongroupRestore" }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "e52423ae-26df-4293-b4d3-073271c85ec0" } }, "DependsOn": [ "ec2Bastion", "appServer", "RDSoptiongroupRestore" ] }, "RDSoptiongroupRestore": { "Type": "AWS::RDS::OptionGroup", "Properties": { "EngineName": { "Ref": "DBEngine" }, "MajorEngineVersion": "15.00", "OptionConfigurations": [ { "OptionName": "SQLSERVER_BACKUP_RESTORE", "OptionSettings": [ { "Name": "IAM_ROLE_ARN", "Value": "arn....." } ] } ], "OptionGroupDescription": "For Restoring bakups from s3 bucket" }, "Metadata": { "AWS::CloudFormation::Designer": { "id": "ce0de1d7-6e19-43c0-9df9-230562178612" } } } } ``` Do I need to create a delay or way to say to cloud formation that I just made this option group, so that that?
1
answers
0
votes
4
views
asked 6 hours ago

Using clientV2. What does `merge-config-service BROKEN` and how does one resolve it?

I have been learning GreenGrass. Rough time. I finally learned how to publish a message to IOT Core and started working on subscribing to a change in shadow. It looks like I have some kind of configuration issue. I dropped all my code and added code from this page at the area: ``` import sys import time import traceback from awsiot.greengrasscoreipc.clientv2 import GreengrassCoreIPCClientV2 from awsiot.greengrasscoreipc.model import ( SubscriptionResponseMessage, UnauthorizedError ) def main(): try: ipc_client = GreengrassCoreIPCClientV2() # Subscription operations return a tuple with the response and the operation. _, operation = ipc_client.subscribe_to_topic(topic='', on_stream_event=on_stream_event, on_stream_error=on_stream_error, on_stream_closed=on_stream_closed) print('Successfully subscribed to topic: ') # Keep the main thread alive, or the process will exit. try: while True: time.sleep(10) except InterruptedError: print('Subscribe interrupted.') # To stop subscribing, close the stream. operation.close() except UnauthorizedError: print('Unauthorized error while subscribing to topic: ') traceback.print_exc() exit(1) except Exception: print('Exception occurred', file=sys.stderr) traceback.print_exc() exit(1) def on_stream_event(event: SubscriptionResponseMessage) -> None: try: message = str(event.binary_message.message, 'utf-8') topic = event.binary_message.context.topic print('Received new message on topic %s: %s' % (topic, message)) except: traceback.print_exc() def on_stream_error(error: Exception) -> bool: print('Received a stream error.', file=sys.stderr) traceback.print_exc() return False # Return True to close stream, False to keep stream open. def on_stream_closed() -> None: print('Subscribe to topic stream closed.') if __name__ == '__main__': main() ``` I started getting these errors: ``` 2022-09-26T22:00:59.732Z [WARN] (pool-2-thread-93) com.aws.greengrass.deployment.DeploymentConfigMerger: merge-config. merge-config-service BROKEN. {serviceName=com.xxxxxxxx.productivity.cycle_count} 2022-09-26T22:00:59.732Z [ERROR] (pool-2-thread-93) com.aws.greengrass.deployment.activator.DeploymentActivator: merge-config. Deployment failed. {deploymentId=085885ea-145f-4b04-86cb-1fac50c84443} com.aws.greengrass.deployment.exceptions.ServiceUpdateException: Service com.xxxxxxxx.productivity.cycle_count in broken state after deployment at com.aws.greengrass.deployment.DeploymentConfigMerger.waitForServicesToStart(DeploymentConfigMerger.java:194) at com.aws.greengrass.deployment.activator.DefaultActivator.activate(DefaultActivator.java:84) at com.aws.greengrass.deployment.DeploymentConfigMerger.updateActionForDeployment(DeploymentConfigMerger.java:150) at com.aws.greengrass.deployment.DeploymentConfigMerger.lambda$mergeInNewConfig$0(DeploymentConfigMerger.java:102) at com.aws.greengrass.lifecyclemanager.UpdateSystemPolicyService.runUpdateActions(UpdateSystemPolicyService.java:95) at com.aws.greengrass.lifecyclemanager.UpdateSystemPolicyService.lambda$startup$0(UpdateSystemPolicyService.java:169) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) ``` My component configuration looks like this: ``` { "RecipeFormatVersion": "2020-01-25", "ComponentName": "com.xxxxxxx.productivity.cycle_count", "ComponentVersion": "1.0.091", "ComponentType": "aws.greengrass.generic", "ComponentDescription": "Simple cycle counting", "ComponentPublisher": "xxxxxxxx", "ComponentConfiguration": { "DefaultConfiguration": { "accessControl": { "aws.greengrass.ipc.pubsub": { "com.xxxxxxxx.productivity.cycle_count:pubsub:1": { "policyDescription": "Allows access to publish/subscribe to all topics.", "operations": [ "aws.greengrass#PublishToTopic", "aws.greengrass#SubscribeToTopic" ], "resources": [ "*" ] } } } } }, "Manifests": [ { "Platform": { "os": "linux" }, "Name": "Linux", "Lifecycle": { "Run": "python3 -u {artifacts:path}/cycle_count.py" }, "Artifacts": [ { "Uri": "s3://xxxxxxxx/cycle_count.py", "Digest": "aRieZLEFNe9fcYrfmMhnLjApeNjop8bn9WlXlzftrpg=", "Algorithm": "SHA-256", "Unarchive": "NONE", "Permission": { "Read": "OWNER", "Execute": "NONE" } } ] } ], "Lifecycle": {} } ``` What is my error here?
1
answers
0
votes
8
views
asked 7 hours ago

Recent articles

see all
1/18