You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## AWS c7i EC2 Instance with 4th Generation Intel® Xeon® Scalable Processor (Sapphire Rapids) & Open Platform for Enterprise AI (OPEA) Code Generation Example
11
+
12
+
## Overview
13
+
14
+
This Module deploys the a Code Generation tool using the Open Platform for Enterprise AI Code Generation example on a Intel® Xeon® c7i AWS Instance. This is optimized for Intel® Advanced Matrix Extensions (AMX).
15
+
16
+
17
+
This demo will showcase Code Generation CPU inference using 4th Gen Xeon Scalable Processors on AWS using the OPEA Code Generation. For more information about OPEA, go [here](https://opea.dev/). For more information on this specific example, go [here](https://github.com/opea-project/GenAIExamples/tree/main/CodeGen).
18
+
19
+
## Usage
20
+
21
+
### variables.tf
22
+
23
+
Modify the region to target a specific AWS Region
24
+
25
+
```hcl
26
+
variable "region" {
27
+
description = "Target AWS region to deploy EC2 in."
28
+
type = string
29
+
default = "us-east-1"
30
+
}
31
+
```
32
+
33
+
Modify the Huggingface Token variable to your specific Huggingface Token, for information on creating a Huggingface token go [here](https://huggingface.co/docs/hub/en/security-tokens)
34
+
35
+
```hcl
36
+
variable "huggingface_token" {
37
+
description = "Huggingface Token"
38
+
default = " <YOUR HUGGINGFACE TOKEN> "
39
+
type = string
40
+
}
41
+
```
42
+
43
+
### main.tf
44
+
45
+
Modify settings in this file to choose your AMI as well as instance size and other details around the instance that will be created
Download and run the [OPEA ChatQnA on Xeon](https://github.com/intel/terraform-intel-aws-vm/tree/main/examples/gen-ai-xeon-opea-codegen) Terraform Module by typing this command
Change into the `examples/gen-ai-xeon-opea-codegen` example folder
110
+
111
+
```Shell
112
+
cd terraform-intel-aws-vm/examples/gen-ai-xeon-opea-codegen
113
+
```
114
+
115
+
Run the Terraform Commands below to deploy the demos.
116
+
117
+
```Shell
118
+
terraform init
119
+
terraform plan
120
+
terraform apply
121
+
```
122
+
123
+
After the Terraform module successfully creates the EC2 instance, **wait ~10 minutes** for the recipe to build and launch the containers before continuing.
124
+
125
+
## Accessing the Demo
126
+
127
+
You can access the demos using the following:
128
+
129
+
- OPEA ChatQnA: `http://yourpublicip:5174`
130
+
- You can also integrate with IDEs like VScode. See documentation [HERE](https://github.com/opea-project/GenAIExamples/blob/main/CodeGen/docker_compose/intel/cpu/xeon/README.md#install-copilot-vscode-extension-from-plugin-marketplace-as-the-frontend)
131
+
132
+
- Note: This module is created using the c7i.24xlarge instance size, you can change your instance type by modifying the **instance_type = "c7i.24xlarge"** in the main.tf under the **ec2-vm module** section of the code. If you just change to an 16xlarge and then run **terraform apply** the module will destroy the old instance and rebuild with a larger instance size.
133
+
134
+
## Deleting the Demo
135
+
136
+
To delete the demo, run `terraform destroy` to delete all resources created.
137
+
138
+
## Considerations
139
+
140
+
- The AWS region where this example is run should have a default VPC
description="The state of the instance. One of: `pending`, `running`, `shutting-down`, `terminated`, `stopping`, `stopped`"
18
+
value=try(module.ec2-vm.*.instance_state, "")
19
+
}
20
+
21
+
output"outpost_arn" {
22
+
description="The ARN of the Outpost the instance is assigned to"
23
+
value=try(module.ec2-vm.*.outpost_arn, "")
24
+
}
25
+
26
+
output"password_data" {
27
+
description="Base-64 encoded encrypted password data for the instance. Useful for getting the administrator password for instances running Microsoft Windows. This attribute is only exported if `get_password_data` is true"
28
+
value=try(module.ec2-vm.*.password_data, "")
29
+
}
30
+
31
+
output"primary_network_interface_id" {
32
+
description="The ID of the instance's primary network interface"
description="The private DNS name assigned to the instance. Can only be used inside the Amazon EC2, and only available if you've enabled DNS hostnames for your VPC"
38
+
value=try(module.ec2-vm.*.private_dns, "")
39
+
}
40
+
41
+
output"public_dns" {
42
+
description="The public DNS name assigned to the instance. For EC2-VPC, this is only available if you've enabled DNS hostnames for your VPC"
43
+
value=try(module.ec2-vm.*.public_dns, "")
44
+
}
45
+
46
+
output"public_ip" {
47
+
description="The public IP address assigned to the instance, if applicable. NOTE: If you are using an aws_eip with your instance, you should refer to the EIP's address directly and not use `public_ip` as this field will change after the EIP is attached"
48
+
value=try(module.ec2-vm.*.public_ip, "")
49
+
}
50
+
51
+
output"private_ip" {
52
+
description="The private IP address assigned to the instance."
53
+
value=try(module.ec2-vm.*.private_ip, "")
54
+
}
55
+
56
+
output"ipv6_addresses" {
57
+
description="The IPv6 address assigned to the instance, if applicable."
58
+
value=try(module.ec2-vm.*.ipv6_addresses, [])
59
+
}
60
+
61
+
output"tags_all" {
62
+
description="A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block"
63
+
value=try(module.ec2-vm.*.tags_all, {})
64
+
}
65
+
66
+
output"spot_bid_status" {
67
+
description="The current bid status of the Spot Instance Request"
68
+
value=try(module.ec2-vm.*.spot_bid_status, "")
69
+
}
70
+
71
+
output"spot_request_state" {
72
+
description="The current request state of the Spot Instance Request"
73
+
value=try(module.ec2-vm.*.spot_request_state, "")
74
+
}
75
+
76
+
output"spot_instance_id" {
77
+
description="The Instance ID (if any) that is currently fulfilling the Spot Instance request"
0 commit comments