Which solution will meet these requirements?
Create a CodePipeline action immediately after the deployment stage of the API. Configure the action to invoke an AWS Lambda function. Configure the Lambda function to download the SDK from API Gateway, upload the SDK to the S3 bucket, and create a CloudFront invalidation for the SDK path.
Create a CodePipeline action immediately after the deployment stage of the API. Configure the action to use the CodePipeline integration with API Gateway to export the SDK to Amazon S3. Create another action that uses the CodePipeline integration with Amazon S3 to invalidate the cache for the SDK path.
Create an Amazon EventBridge (Amazon CloudWatch Events) rule that reacts to UpdateStage events from aws.apigateway. Configure the rule to invoke an AWS Lambda function to download the SDK from API Gateway, upload the SDK to the S3 bucket, and call the CloudFront API to create an invalidation for the SDK path.
Create an Amazon EventBridge (Amazon CloudWatch Events) rule that reacts to CreateDeployment events from aws.apigateway. Configure the rule to invoke an AWS Lambda function to download the SDK from API Gateway, upload the SDK to the S3 bucket, and call the S3 API to invalidate the cache for the SDK path.
Explanations:
This option uses CodePipeline to invoke a Lambda function after deployment. The Lambda function handles downloading the SDK from API Gateway, uploading it to the S3 bucket, and creating a CloudFront invalidation for the SDK path. This is the most automated and flexible solution.
This option suggests using CodePipeline’s native integration to export the SDK to S3 and invalidate the CloudFront cache. However, CodePipeline does not natively support exporting the SDK to S3 from API Gateway, nor does it handle CloudFront invalidation directly.
This option triggers on UpdateStage events, which is not the most suitable event for API deployment. The correct event is CreateDeployment. Furthermore, the event should trigger the SDK export and CloudFront invalidation process, not just rely on the UpdateStage event.
This option triggers on CreateDeployment events but suggests invalidating the cache through S3, which is incorrect because CloudFront invalidations are required, not S3 invalidation. CloudFront is responsible for cache invalidation, not S3.